Home > CRM 2011, JScript > Get and Set ‘Partylist’ fields using Jscript

Get and Set ‘Partylist’ fields using Jscript

If you observe “Required” lookup field on an ‘Appointment’ form, you can choose more than one Accounts or Contacts or Users.

Though it looks like a normal lookup field actually it’s a field of type ‘Party list’.

Party List :-

  • Party List is a data type in CRM, using which you can set more than one records of an entity for a single field.
  • Part List type field, renders as Lookup on the form, but it works as multi select lookup.
  • We can’t create a custom party list fields.

For example,

  • In the ‘Appointment’ entity field “Required” is a ‘Party List’ type
  • We can select multiple records of different type (i.e., Accounts, Users, Contacts…)
Partylist Type

Partylist Type

Below is Jscript to Get or Set ‘Partylist’

function getPartyList() {

var partyRequired = Xrm.Page.getAttribute(“requiredattendees”);

var attendees = party.getValue();

for (var indxAttendees = 0; indxAttendees < attendees.length; indxAttendees++) {

// User

if (attendees[indxAttendees].type == 8) {

alert(“Attendee is User; Id -” + attendees[indxAttendees].id + ” Name -” + attendees[indxAttendees].name);


// Contact

if (attendees[indxAttendees].type == 2) {

alert(“Attendee is Contact; Id -” + attendees[indxAttendees].id + ” Name -” + attendees[indxAttendees].name);




function setPartyList() {

var partyRequired = Xrm.Page.getAttribute(“requiredattendees”);

// Create new array

var partlist = new Array();

partlist[0] = new Object();

partlist[0].id = id; //Guid (i.e., Guid of User or Contact etc)

partlist[0].name = name; //Name (i.e., Name of User or Contact etc)

partlist[0].entityType = entityType; //entity schema name of account or contact

// Set array value



Hope it helps 🙂

  1. tirunesh@yahoo.com
    May 17, 2012 at 12:06 AM

    This looks very helpful Rajeev , what are the steps required to implement this code ? Please help

  2. June 24, 2012 at 5:04 PM

    I use your way to set a value in phonecall entity “to” or recipient, it not working. I use CRM 2011 on premie, why? the followin is the code

    var o1 = new Array();
    o1[0] = new Object();
    o1[0].id = queryStringParams[“followup_3”] ;
    o1[0].name = queryStringParams[“followup_4”] ;
    o1[0].entityType = queryStringParams[“followup_5”] ;

    • Pramod ray
      January 4, 2019 at 6:06 PM

      how to set value in reqiredattendace field create appointment

  3. June 24, 2012 at 6:16 PM

    Please make sure you are setting right values using “queryStringParams”. Post the values you are passing and error text to find out cause of issue.

  4. December 20, 2012 at 12:17 PM

    hi Rajeev,
    I used your code set to field of email form.It sets the value.But when i click on the link it opens the create new record,even if the record exists.

    • December 21, 2012 at 10:17 PM

      Did you set the 3 propeties
      partlist[0].id = id; //Guid
      partlist[0].name = name;
      partlist[0].entityType = entityType; //entity schema name

      Did the lookup resolve the party you set.
      Please provide your script to analyze more.

  5. December 22, 2012 at 10:28 AM

    Hi Rajeev,
    Thanks for your code it worked.
    I Used code below and it is working fine.
    var o1 = new Array();
    o1[0] = new Object();
    o1[0].id =fieldid;
    o1[0].name = tofieldname ;
    o1[0].entityType = ‘account’;

  6. Selva Antony
    March 28, 2013 at 12:50 PM

    Hi Rajeev,

    Is there a way to make use of this party list field in any of our custom entity in crm 2011?
    If so please guide to proceed, that will be really really helpful for me.


    • March 28, 2013 at 11:32 PM

      Hi Selva,
      We cant create new PartyList field. However, you can create a new custom activity, with that you get out of the box PartyList fields.

  7. Selva
    May 10, 2013 at 3:14 PM

    Hi Rajeev,

    I would like to make use of the partly list to Case entity. Is that possible to achieve?


  8. June 17, 2013 at 1:56 PM

    Hi Rajeev,
    Thanks for this great post. I would like to add a ressource to a service activity using soap endpoint, but I don’t seem to get it right …
    var CRMObject = new Object();
    var partlistData = new Array();
    partlistData[0] = new Object();
    partlistData[0].id = MyUser[0].id;
    partlistData[0].name = MyUser[0].name;
    partlistData[0].entityType = “SystemUser”;
    CRMObject.Resources = partlistData;
    What’s wrong with my configuration ?? thanks in advance

    • June 17, 2013 at 2:16 PM

      Can you try by giving “SystemUser” lowercasing. (i.e., partlistData[0].entityType = “systemuser”).
      Let me know if you still face the issue.

  9. Pawa Joshi
    December 25, 2013 at 5:10 PM

    in this syntax what is the “to”
    can anyone please help

    • December 26, 2013 at 10:59 AM

      ‘to’ is the field name of Appointment entity.

  10. March 20, 2014 at 3:51 PM

    Is there a way to set an Email for ex(abc@bbc.com) in the To value of the email

    • March 20, 2014 at 4:03 PM

      No Varun.

      It considers the ‘Primary Email’ (I.e.,emailaddress1) field value of the Contact\User\Account .

  11. Sachin
    March 26, 2014 at 3:34 AM

    Hi Rajiv,

    I have a requirement when user create email activity from custom entity (contract) then in “To” field of email activity form, user can see the all the contacts associated to contract account (means account is parent of contract record) . So here i have to create one filtered custom view on Contact associated to Account. Can you help me , how to achieve this?

  12. December 15, 2014 at 7:01 PM

    Reblogged this on Dynamicsofdynamicscrm and commented:
    This was a recent query asked to me. Adding a solution done by my old colleague Rajeev here:

  13. Sunil R
    May 22, 2015 at 3:12 AM

    Thanks a lot for this blog. It really helped solve my purpose.

  14. Rajesh
    September 3, 2015 at 7:50 PM

    For me the images are not displaying on booth the partylist however, data are swaping and setting entity attribute correctly. Could you please help me

  15. Avik Banerjee
    December 17, 2015 at 6:39 PM

    The following alteration worked for setting email’s to attribute in CRM 2015, the only change is object’s type is to be set and not entitytype.
    var partlistData = new Array();
    partlistData[0] = new Object();
    partlistData[0].id = Xrm.Page.context.getUserId();
    partlistData[0].name = Xrm.Page.context.getUserName();
    partlistData[0].type = 8;

    Appreciate your blogs, Rajiv!

  16. Tri
    February 3, 2016 at 2:55 AM

    Hi Rajeev,
    Thanks for posting this useful blog.
    I’m trying to insert multiple participants into the email “to” field when users click on “Reply All” email. However I need to remove certain email address from the To line. So I put the original To into an array and then loop and get all the email addresses except the one that needs to be removed.

    However the problem here is I only see the first participant is listed on the Reply All email form. Could you please advise on how to populate multiple email participants? Appreciate your help in this, thanks in advance.

    Here’s my code:
    var toParty = Xrm.Page.getAttribute(“to”).getValue();

    var partyListArray = new Array();
    for (var indxAttendees = 0; indxAttendees < toParty.length; indxAttendees++) {
    //using oData to get participant email address
    var email = getParticipantEmail(toParty[indxAttendees].entityType, toParty[indxAttendees].id);
    if (email != "test@test.com") {
    partyListArray[indxAttendees] = new Object();
    partyListArray[indxAttendees].id = toParty[indxAttendees].id;
    partyListArray[indxAttendees].name = toParty[indxAttendees].name;
    partyListArray[indxAttendees].entityType = toParty[indxAttendees].entityType;


  17. Raghu Nandan
    October 11, 2016 at 1:14 PM

    Hi Rajeev,

    I have the following problem:

    When I enter values in “Required” field in Appointment and then while converting the appointment to Case the pop-up auto populates the “Customer” value with the “Required” value in appointment. That is working fine.
    But when I do the same for a custom activity, then the “Customer” field is not getting populated with the “Required” filed value on custom activity.

    Is that the expected behavior for a custom activity or we need to do anything else ?


  18. Surbhi Rastogi
    December 28, 2017 at 8:08 PM
  19. Jyoti Nandakr
    August 2, 2022 at 2:15 PM

    hello rajeev can we use this code

    crmForm.all.requiredattendees.setAttribute(“defaulttype”, “2”);

    crmForm.all.requiredattendees.setAttribute(“lookuptypes”, “2”);

    crmForm.all.requiredattendees.setAttribute(“lookuptypeIcons”, “/_imgs/ico_16_2.gif”);

    to disable one of the entity from party list in CRM 2016

  1. December 15, 2014 at 8:15 PM
  2. April 17, 2015 at 8:33 PM

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 )

Connecting to %s

%d bloggers like this: