Dynamics 365





Monday, November 27, 2017

Loading IFrame on form - MS CRM Dynamics javascript

This is helpful to set the URL to IFRAME using javascript in MicroSoft Dynamics CRM.

use below script as reference to your javascript webresource.

you need to call the SetTransactionFrame() from onload even and save event of crm form.

// script to webpage to Iframe .. load web page on MS CRM form IFRAME.



var transactionsURL = "http:blogger.com";

function SetTransactionFrame()
{

 var subjectValue = Xrm.Page.getAttribute("subjectid").getValue();

 if ((subjectValue != null)) {
 
var subjectName = subjectValue[0].name;


var formType = Xrm.Page.ui.getFormType();
    if (formType !== 1 && subjectName=="yoursubject" )
        {
SetIFrameURL();
}
else
{
//"Details" - tab name
Xrm.Page.ui.tabs.get("Details").sections.get("Details_section_2").setVisible(false);
}

   }
}

function SetIFrameURL() {

    var CaseId = Xrm.Page.data.entity.getId();
    var UserId = Xrm.Page.context.getUserId();
   var FormType ="case";

    var transactionsURL = TransactionDetailsURL + '?id=' + CaseId +'&userid=' +UserId +'&typename='+FormType;


Xrm.Page.getControl('IFRAME_Transactions').setSrc(transactionsURL);
}

No comments:

Post a Comment