Sunday, April 10, 2016

Key values in CRM Lookup fields

I have been working with CRM for nearly 9 years but I have never been aware of the “Key Values” available in the lookup control. Generally, when we retrieve the lookup control in JavaScript, we use code similar to the following :
 lookupFieldObject ='parentaccountid');   
 if (lookupFieldObject.getValue() != null) {   
 entityId = lookupFieldObject.getValue()[0].id;   
 entityName = lookupFieldObject.getValue()[0].entityType;   
 entityLabel = lookupFieldObject.getValue()[0].name;   
 What are the key values for lookup control?
If you select the lookup entity on a form, the lookup control also contains a collection of key values that have other fields from the lookup entity. The screenshot below displays the key values available for an account lookup, when I select a parent account from a contact form.
The screenshot displays the collection of other account attributes such as abn, address1state, address1_city, primarycontactid, telephone 1, etc. I did not know that these values were also available for a lookup control. Sometimes we need to retrieve the other attributes of the lookup entity and these key values can be used to retrieve them, instead of making an additional call.
Where are these values coming from?
After doing a bit of research, we have found that these attributes/values are coming from the lookup view of the entity.
Here is the lookup view of the account entity in my system.
These are the same fields as shown in the Key Values collection in the screen shot above.
Now to the bad news. These key values are not available all the time. These values are only available if you select the value manually from the form. These values won’t be available if the lookup value is set via code or a workflow. My colleague, Mr. Davey has an explanation, that these values get cached when we select the lookup control on the form. That sounds like a good explanation.


  1. Discover the best of crm software you can follow us our sites please be know as :-The right fact about the crm development is the way you are managing this particular tool and how it is known to handle crm software for small business each and every aspect about the work. There are several of such options as well as features all coming up in the market which will be definitely helpful online CRM software and essential in all ways.

  2. I was just figuring out where these keyvalue vanished for my lookup in quick view form so now your blog explains it why! Thanks!