In this webinar, our experts showcase a variety of demo use cases of how different components of the...
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.
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 =; lookUpObject.name = "Joe CRM"; lookUpObject.entityType = 2; Xrm.Page.getAttribute(" ").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 =; partlistData[0].name = "Joe CRM"; partlistData[0].entityType = 2; Xrm.Page.getAttribute("to").setValue(partlistData);
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!
var partlistData = new Array();
Why would you do that instead of `var partylist = [];`?
Hello, I do it the way you showed but I get: Attribute 'partyobjecttypecode' cannot be NULL when I try to save, could yo please advise? thank you
I have the same error, did you find a solution?
Hey Joe! Any idea on how to change the sender address from an email to default to the queue the original mail was sent to, i.e. automatically/dynamically ?
in crm 2013 i'd guess it would be through the parentactivityid, but dunno how to do use it.
thanks
When setting a PartyList, how do you add additional records? I'm guessing it's just a matter of repeating the middle 4 lines of code with partlistData[1], partlistData[2], etc. ?
Tried to alter a "from" field on an Email, finally figured it works like a party list:
var lookUpObject = new Array();
lookUpObject[0] = new Object();
lookUpObject[0].id = ai_queue_ai_servicecenter.Id;
lookUpObject[0].name = ai_queue_ai_servicecenter.Name;
lookUpObject[0].entityType = "queue";
Xrm.Page.getAttribute("from").setValue(lookUpObject);