domingo, 15 de septiembre de 2013

CRM 4.0 - Ver en un Iframe la vista de otra entidad

Ver código de una búsqueda


javascript:void( alert( advFind.FetchXml ))
javascript:alert(document.body.outerHTML)
javascript:alert(resultRender.outerHTML)


Ver código de una vista


javascript:alert(document.frames[1].location)



Código de ver vista en IFRAME de otra entidad


if(crmForm.FormType == 1)
{
document.all.IFRAME_Case.src="about:blank";
}
else
{
var navService;
navService= "nav_new_intermedia_new_final";
document.all.navService;

if (navService!= null)
{
var lookup= crmForm.new_intermediaid;
var id= lookup.DataValue[0].id;
var objectid= "{6EE80775-0949-DD11-9AA8-000C299B7642}";
objectid= id;
//this optional code hides the activity from the left navigation bar
//navService.style.display = "none";
document.all.IFRAME_Finales.src="/" + ORG_UNIQUE_NAME + "/userdefined/areas.aspx?oId=" + objectid + "&oType=" + "10001" + "&security=852023&tabSet=new_intermedia_new_final";
alert(document.all.IFRAME_Finales.src);
}
}

-------------------------------------------------------------
Go to Edit and click on “Find NEXT”.  The search criterion is “loadarea”. The first one found should be in a
<div> tag.  The “id=’this’” is the “nav” part to be used in the code.
-------------------------------------------------------------




Por Jim Wang:

CRM 4.0 IFrame: Show Advanced Find Result View


1. Build your Advanced Find query and save it, then copy the Shortcut.
2. Put a IFrame control on the Form, clear the "Restrict cross-frame scripting" checkbox.
3. Put the below code to the OnLoad() event, you need to change the IFRAME_view name and the iFrame.src (copy and paste from the step 1)

var iFrame = crmForm.all.IFRAME_view;
iFrame.src = SERVER_URL + "/advancedfind/advfind.aspx?etn=contact&QueryId=%7b3882F0FA-2B3A-DE11-BFB8-0018FE7F3A64%7d&ViewType=4230&AutoRun=True";
iFrame.attachEvent( "onreadystatechange" , Ready);
function Ready()
{
  var iDoc = iFrame.contentWindow.document;
  if(iDoc.getElementById("crmMenuBar") != null && iDoc.getElementById("btnBack") != null)
  {
    iDoc.getElementById("crmMenuBar").style.display = "none"; // hide the top menu bar
    iDoc.getElementById("btnBack").style.display = "none"; // hide the bottom BACK button
  }
}

CRM 4.0 IFrame: Show Entity's Associated View


It's a common requirement to show entity's associated view(1:N, N:N) in IFrame, the below code works for both 1:N and N:N relationship,
it also works on both On-Premise and IFD deployment. All you need to do is find out(IE Developer Toolbar) the ID of the associated link.
The 1:N relationship needs these parameters in the request URL: oId, oType, security, tabSet
The N:N relationship needs an extra parameter: roleOrd in the request URL, which has been involved in the code.

var navId = "nav_new_new_myentity_account";
if(document.getElementById(navId) != null)
{
  var tmp = document.getElementById(navId).onclick.toString();
  tmp = tmp.substring(tmp.indexOf("'")+1, tmp.indexOf(";"));
  var loadArea = tmp.substring(0, tmp.indexOf("'"));
  var roleOrd =  (tmp.indexOf("roleOrd") == -1) ? -1 : tmp.substring( tmp.indexOf("roleOrd"), tmp.lastIndexOf("'")).replace("\\x3d", "=");
  crmForm.all.IFRAME_view.src = (roleOrd == -1) ? GetFrameSrc(loadArea) : GetFrameSrc(loadArea) + "&" + roleOrd;
}
function GetFrameSrc(tabSet)
{
  if (crmForm.ObjectId != null)
  {
    var id = crmForm.ObjectId;
    var type = crmForm.ObjectTypeCode;
    var security = crmFormSubmit.crmFormSubmitSecurity.value;
    var path = document.location.pathname.substring(0, document.location.pathname.indexOf("edit.aspx")) + "areas.aspx?";
    return (path + "oId=" + id + "&oType=" + type + "&security=" + security + "&tabSet=" + tabSet);
  }
  else
  {
    return "about:blank";
  }
}

No hay comentarios:

Publicar un comentario