Follow Us:
CRM 2011 introduced a new page model for JScript and it has thrown some people for a bit of a loop because it is so different from the model in CRM 4.0. The SDK has a lot of examples, but they are often over-kill when you're just trying to figure things out.
As a simple example to get started, let's say that you just want to get the GUID from a lookup field on a form. First, create a web resource with the following JScript function and then call the web resource and the function from your form's OnLoad event.
In this example, we want to get the GUID from the Potential Customer lookup on an Opportunity (assuming it's already there - this code doesn't include any checks to see if it has been set yet):
function showGUID() { var Customer = Xrm.Page.getAttribute('customerid').getValue(); var CustomerId = Customer[0].id; alert(CustomerId); }
The trick is the second variable. A lookup is actually an array. It contains three values: a name, an entity type, and the GUID (or id). If you wanted to know if the Potential Customer was set to an Account or Contact, you could change the second variable to Customer[0].entityType.
Customer[0].entityType
The complementary paper includes over 12 years of research, recent survey results, and CRM turnaround success stories.
Request Download
This 60-second assessment is designed to evaluate your organization's collaboration readiness.
Learn how you rank compared to organizations typically in years 1 to 5 of implementation - and which areas to focus on to improve.
This is a sandbox solution which can be activated per site collection to allow you to easily collect feedback from users into a custom Feedback list.
Whether you are upgrading to SharePoint Online, 2010, 2013 or the latest 2016, this checklist contains everything you need to know for a successful transition.