Get and Set Look Up Details in CRM 2011/2013/2015.


Here is the JavaScript for getting/setting Look Up details in CRM 2011/2013/2015.

// Get Look Up Details.

function getLookUp() {
    var varEntityName, varEntityId, varEntityType, varLookupFieldObject;
    var varLookupFieldObject =“parentaccountid”);
    // Get Parent Account Details.
    if (varLookupFieldObject.getValue() != null) {
        varEntityId = varLookupFieldObject.getValue()[0].id;
        varEntityType = varLookupFieldObject.getValue()[0].entityType;
        varEntityName = varLookupFieldObject.getValue()[0].name;
        setLookUpValue(varEntityId, varEntityName, varEntityType)

// Set the Look Up.
function setLookUpValue(accountId, accountName, entityLogicalName) {
        id: accountId,
        name: accountName,
        entityType: entityLogicalName

Hope this helps.

Happy CRM’ing

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s