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

Strange and Inconsistent Behavior with JavaScript setValue of a GUID into a Textbox

$
0
0

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. 


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>