Retriving entity ID does't match Xrm.Page.getAttribute('customerid').getValue();

Feb 12, 2014 at 1:20 PM
It's unfortunate that when you use the XrmSvcToolkit.retrieve method, and get the ID of a record, and then you use the Xrm.Page... method (see below) and then compare the two GUIDs, they are not the same.

One has curly brackets and the other doesn't.

But even when I add curly brackets to the one that doesn't, it doesn't seem to be the same. Maybe it's a different type? Anyway, it's very strange, but makes for a bit more hassle...

Any advice?

var Customer = Xrm.Page.getAttribute('customerid').getValue();
var CustomerId = Customer[0].id;
Feb 12, 2014 at 1:22 PM
There is a utility method in XrmSvcToolkitTest.aspx file which is called compareGuid. You can use this method to compare which should take care of the issue.
Feb 12, 2014 at 1:31 PM


We will add that to our “Common” library of functions that we include on every entity.

Thanks a lot Daniel!