I have an iFrame with a custom web page loaded. The page (on_load) looks for the entity id (this is a custom entity). When the record exists, this works fine, however, when I create a new record there is no ID initially so it displays an error. All that is as expected.
I am trying to refresh the link when the record is saved. I have created a javascript function that reads the current link.src, attempts to append the new record id, and then puts the new url as the new .src for the link.
So this runs in the onSave event for this form:
//lnk is passed in as the control name for this iFrame and it is valid and working
var formType = Xrm.Page.ui.getFormType();
var src = Xrm.Page.getControl(lnk).getSrc();
if (formType == 1) {
var rmaid = Xrm.Page.data.entity.getId();
if (rmaid == null || rmaid == "") { setTimeout("doRefreshLink()", 1000); }
else {
src += rmaid;
document.getElementById(lnk).src = src;
}
}
It appears the server side save will not run until this onSave function is completed (not running asynchronously). Is that true?
The real issue is how to I get the ID so I can refresh this page?