how to set the Lookup and PartyList Lookup in mscrm

In the example below, the Sender on the phone call is a Lookup field. To populate a Lookup field with JavaScript, you would use the code below:

   lookUpObject.id = <guid>;
   lookUpObject.name = "Joe CRM";
   lookUpObject.entityType = 2;               
   Xrm.Page.getAttribute("<LookUpFieldName>").setValue(lookUpObject);
You’ll also see in the example below that the Recipient on the phone call is a PartyList field. This is the JavaScript you would use to populate a PartyList field:

   var partlistData = new Array();
   partlistData[0] = new Object();
   partlistData[0].id = <guid>;
   partlistData[0].name = "Joe CRM";
   partlistData[0].entityType = 2;
   Xrm.Page.getAttribute("to").setValue(partlistData);

Comments

Popular posts from this blog

Basic Plugin Code in D365 using C#

CURD (Create, Update, Retrieve and Delete) Operation in D365 using Power Shell Script

Meta Data Using WebApiRequest