› Dynamics 365, Enterprise › Set Party List field using JavaScript in Dynamics CRM

Set Party List field using JavaScript in Dynamics CRM

 Krishna Bhanushali   Leave a comment

Introduction:

In this blog, we are going to discuss how to set a party list field using JavaScript in Dynamics CRM. Many times, there is a requirement that any email send from CRM must be send from a specific user, irrespective of the user logged in to CRM.

Scenario:

In the Incident Management, there is a need that each mail send from CRM to Customers must be send from Support User.

Steps:

Step 1: Write a function on load of email form. Retrieve the Queue or User you want to set from Web API

Step 2: Party List basically consists of User or a Queue. So, we can set User or a Queue in party list. You can differentiate the User and Queue by specifying the Entity Type.

a. Queue: “queue”
b. User: “systemuser”

Code is given below: 

var partylistData = new Array();
partylistData[0] = new Object();
partylistData[0].id = queue.value[0].queueid; partylistData[0].name = queue.value[0].name; partylistData[0].entityType = "queue"; Xrm.Page.getAttribute("from").setValue(partylistData);

More validation can be set on basis of the requirements. On the status of the email validation can be done.


Liked it? Share it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.