Add setIFrameSource function to your crm form OnLoad event.
function onCrmFormLoaded() {
// ...
//Display related records in iframe
setIFrameSource();
// ...
}
function setIFrameSource() {
if (crmForm.ObjectId) {
// Generate url to display related records
var url = 'areas.aspx?oId=' + crmForm.ObjectId + '&oType=10000&security=852023&tabSet=new_new_myentity=entityA_new_entityB';
// Set iframe source
crmForm.all.IFRAME_entity.src = url;
// Remove padding when iframe is loaded
crmForm.all.IFRAME_entity.attachEvent('onreadystatechange', onIFrameReady);
}
else {
// Hide iframe
crmForm.all.IFRAME_entity.parentElement.parentElement.style.display = 'none';
}
}
function onIFrameReady(e) {
if (e.srcElement.readyState == 'complete') {
var doc = e.srcElement.contentWindow.document;
// Remove scrolling space
doc.body.scroll = "no";
// Remove crmGrid default padding
doc.body.childNodes[0].rows[0].cells[0].style.padding = 0;
}
}
No comments:
Post a Comment