Michael Philip's Blog

Writing about MS Tech with strong focus on Azure & CRM

Set Lookup Using Java Script – MS CRM 2011

Leave a comment

Brief: you have a lookyup on your form and you would like to set it regarding specific record in a

specific  entity (for ex : Account or Contact ) .

Code:

Xrm.Page.getAttribute(“LookypAttributeSchemaName“).setValue( [{id: idValue, name: textValue, entityType: typeValue}]);
or
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id =YourID;
lookupValue[0].name =YourName ;
lookupValue[0].entityType =YourEntityType ;
Xrm.Page.getAttribute(“LookypAttributeSchemaName“).setValue(lookupValue);
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s