POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

There are many benefits to using JavaScript with Microsoft Dynamics CRM 2011, including achieving on screen automation. In today’s blog, we’ll discuss how to use JavaScript on the field type of Lookup and PartyList.

development

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);

The PartyList field in CRM 2011

The PartyList field is used in multiple places in addition to the Phone Call. For example, the To field on an Email, or the Required field on the Appointment.

For more resources on this topic, check out our blog on Reporting on Activities in Microsoft Dynamics CRM, which describes the different PartyList fields and how they are used.

Happy CRM’ing!


Avatar for Joe D365

Joe D365

Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.