Changing Settings for Activity Party in Email Form

Changing Settings for Activity Party in Email Form

We have all used the email form in CRM 2011, however many times we might want to customize the activity party fields (to, cc, bcc), so that we can restricted the email enabled entities.
The image below displays the default entities that will be shown when we click on the activity party lookup button. Notice that custom email enabled entities will also be shown on this list.

In order to modify the entities, we will have to set the lookuptypes, lookuptypeicons and lookuptypename attributes of the activity party field as shown in the code below.
We can also set the defaulttype that will display when we open the lookup dialog window.

We have all used the email form in CRM 2011, however many times we might want to customize the activity party fields (to, cc, bcc), so that we can restricted the email enabled entities.
The image below displays the default entities that will be shown when we click on the activity party lookup button. Notice that custom email enabled entities will also be shown on this list.

In order to modify the entities, we will have to set the lookuptypes, lookuptypeicons and lookuptypename attributes of the activity party field as shown in the code below.
We can also set the defaulttype that will display when we open the lookup dialog window.

function modifyActivityParty()
{
    var to = document.getElementById("to");
    to.setAttribute("lookuptypes", "1,2,10000");
    to.setAttribute("lookuptypeicons", "/_imgs/ico_16_1.gif,/_imgs/ico_16_2.gif,/WebResources/ico_license16.gif");
    to.setAttribute("lookuptypenames", "account:1,contact:2,bgx_license:10000");
    to.setAttribute("defaulttype", "10000");
}

After the customizations have been published, only the required entities will be shown on the when the activity party lookup control is opened.
You will notice that the License custom entity is the default entity as set in the defaulttype attribute.

In order to select multiple results, you will have to set the lookupstyle attribute to “multi” as well.

Note that the above code might have to be modified for other supported browsers after applying CRM 2011 UR12.
This blog post is no longer supported in newer releases of Dynamics CRM and Dynamics 365. Access to the DOM is deprecated.