Customize PartyList in CRM 2013 and 2015

We used to customize partylist in CRM 2011 by using the following code.

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

lookuptypenames = ‘contact:2:Contact,systemuser:8:User’;
lookuptypes = ‘2,8’;
if ( != null) {“defaulttype”, “2”);“lookuptypes”, lookuptypes);“lookuptypenames”, lookuptypenames);“lookuptypeIcons”, lookuptypeIcons);
       Xrm.Page.getControl(“to”).setDefaultView(“A2D479C5-53E3-4C69-ADDD-802327E67A0D”); //GUId for  default View 

This code won’t work in CRM 2013 and 2015 but we can achieve same functionality by write the code on the focus of the field
$(#to).focus(function () {

    var toLookUp = $(“img[attrName=’to’]”);
    var lookuptypeIcons = ‘/_imgs/ico_16_2.gif?ver=828891367:/_imgs/ico_16_8.gif??ver=828891367’;
  var lookuptypenames = ‘contact:2:Contact,systemuser:8:User’;
    lookuptypes = ‘2,8’;
    if (toLookUp.length > 0) {
        toLookUp[0].setAttribute(“lookuptypenames”, “contact:2:Individual,systemuser:8:User”);
        toLookUp[0].setAttribute(“lookuptypes”, “2,8”);
        toLookUp[0].setAttribute(“lookuptypeIcons”, lookuptypeIcons);
        toLookUp[0].setAttribute(“createpermissiondictionary”, “contact:true,systemuser:true”);
        toLookUp[0].setAttribute(“DefaultViewId”, “A2D479C5-53E3-4C69-ADDD-802327E67A0D”);
        toLookUp[0].setAttribute(“defaulttype”, 2);

Happy CRM’img

5 thoughts on “Customize PartyList in CRM 2013 and 2015

  1. Unknown March 30, 2016 / 12:47 pm

    Hi….I wrote this code function Test(){alert(\”hello\”);$(\”#to\”).focus(function () {var theLookupTO = $(\”img[attrName='to']\”);alert(theLookupTO);if(theLookupTO.length > 0){theLookupTO[0].setAttribute(\”lookuptypenames\”, \”systemuser:8:User\”);theLookupTO[0].setAttribute(\”lookuptypes\”, \”8\”);theLookupTO[0].setAttribute(\”lookuptyprIcons\”, \”/_img/ico_16_8.gif?ver=828891367\”);theLookupTO[0].setAttribute(\”createpermissiondictionary\”, \”systemuser:true\”);theLookupTO[0].setAttribute(\”DefaultViewID\”, \”{A2D479C5-53E3-4C69-ADDD-802327E67A0D}\”);theLookupTO[0].setAttribute(\”defaulttype\”,\”8\”);}});} and then called the function Test.But it did not work. can you please help if anything else to be done to write a jQuery


  2. Unknown May 17, 2017 / 3:53 am

    Hi Gopinath,i tried to use your code , but couldnt achieve it. can help ??


  3. Unknown October 16, 2018 / 9:35 am

    Hi gopi,i tried the same but couldnt achieve this. do we need to add any jquery reference for this??


Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google photo

You are commenting using your Google 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