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.
var to = document.getElementById("to");
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.