Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Xrm.Page.data is null on form load. Once we reload/refresh the form then its value get initilize

$
0
0

Hi

I am using below JavaScript code snippet on Quick Create Form load. When I am getting open a quick create from from account the value of contentFrame.contentWindow.Xrm.Page.data is null. But when I refresh the page then Page.data get initialize and start working. Please let me know how should I resolve this issue and avoid page refresh step.

autoBindQuickCreateContact= function () {
var contextParams = Xrm.Page.context.getQueryStringParameters();
if (contextParams._CreateFromType !== null) { 
var contentFrame = top.document.getElementById("contentIFrame0");
if (contentFrame != null) {
if (contentFrame.contentWindow.Xrm.Page !== null) {
if (contentFrame.contentWindow.Xrm.Page.data != null) {
var recordId = contentFrame.contentWindow.Xrm.Page.data.entity.getId(),
name = contentFrame.contentWindow.Xrm.Page.getAttribute("name").getValue(),
entity = contentFrame.contentWindow.Xrm.Page.data.entity.getEntityName(),
lookupValue = new Array();

lookupValue[0] = new Object();
lookupValue[0].id = recordId;
lookupValue[0].name = name;
lookupValue[0].entityType = entity;
if (xrm.Page.getAttribute("parentcustomerid") !== null) {
xrm.Page.getAttribute("parentcustomerid").setValue(lookupValue);
}
}
}
}
}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images