I am encountering an extremely strange behavior when I try to set the GUID that I retrieve from a related entity via Lookup in a text box using Javascript that triggers OnChange.
If I use the Script below with the alert, it shows the GUID in the alert, and successfully sets the value of the "new_licenseeguid" field to the retrieved GUID. - works perfect.
function SetGUIDinField() {
var licenseValue = Xrm.Page.getAttribute("new_licensefrmlicensee").getValue();
if (licenseValue != null) {
alert(licenseValue[0].id);
Xrm.Page.getAttribute("new_licenseeguid").setValue(licenseValue[0].id);
debugger;
} else {
Xrm.Page.getAttribute("new_licenseeguid").setValue("Mickey Mouse");
}
}Problem is, I need to eliminate the alert but as soon as I remove the alert code, re-publish the solution, and then reload the page and refresh my browser, when I trigger the on change, nothing happens, NOT EVEN AN ERROR!
I was able to get the debugger in place and I am able to confirm that the value of licenseValue[0].id is the expected GUID string.
Since alert(licenseValue[0].id) always displayed the expected value without incident, I know I have the value.
Is there somewhere specific I can look in the debugger that shows if "Xrm.Page.getAttribute("new_licenseeguid").setValue(licenseValue[0].id);" actually executed and what the result was?
When I hit F5 to step through the debugger to the end, no exceptions occur, but also setValue(licenseValue[0].id) doesn't put anything in the text box, and Mickey Mouse doesn't appear there either.
Any help would be greatly appreciated.



