Advertisements
Home > CRM, CRM 2011, JScript > Filtering partylist entities using jscript in CRM

Filtering partylist entities using jscript in CRM

In CRM, partylist Party List is a data type, using which you can set more than one type of entity records for a single field

For example,

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

In one of my requirement, I have to restrict the party list field to show only ‘Contacts’. (i.e., I can only choose Contacts)

We can achieve by setting below properties to partylist field using jscript

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

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

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

Here ‘2’ is the Entity Type Code of ‘Contact’ entity

After setting the properties, the partylist look as below with ‘Contact’ chosen as default and in disabled state to restrict other entity selction

Filtered Party List

Filtered Party List

In case you have to filter 2 entities, let’s say Contact & User you have to set “lookuptypes & lookuptypenames & lookuptypeIcons” properties

            lookuptypeIcons = ‘/_imgs/ico_16_2.gif:/_imgs/ico_16_8.gif’;

lookuptypenames = ‘contact:2:Contact,systemuser:8:User’;

lookuptypes = ‘2,8’;

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

crmForm.all.requiredattendees.setAttribute(“lookuptypenames”, lookuptypenames);

crmForm.all.requiredattendees.setAttribute(“lookuptypeIcons”, lookuptypeIcons);

🙂

Advertisements
  1. September 11, 2012 at 10:06 PM

    Hi,

    Isn’t this for CRM 4.0?
    I think CRM 2011 uses Xrm.Page.*

    Best regards,
    Fernando

    • September 13, 2012 at 7:03 PM

      Hi Fernando,
      It works for both CRM 4.0 & CRM 2011 as CRM 2011 supports backward compatibility.

  2. April 25, 2013 at 6:27 PM

    Hi Rajeev
    Useful blog, thanks. Do you know how to set the columns that are searched by a partylist lookup in CRM4? It doesn’t seem to obey the search settings of the individual entity lookups, so the settings must be held somewhere else, but I can’t figure out where.
    Grateful for any help,
    Adam

  3. April 14, 2014 at 1:52 AM

    this is not supported in crm 2013

  1. No trackbacks yet.

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 )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: