What is the Issue?
Developers got requirement once in his development career to set the lookup value with only some particular entities like he only needs “users”, “contacts” and restrict other entity’s records to be selected. But he/she have to implement this for some conditions like on change of some field value. But this kind of lookup always shows all the entities in lookup.
This lookup field shows all the entities as it’s default OOB behavior of the multi-entity Lookup (Party List).
Lets have Example-
I want to show only “Contact” and “User” records in “To”,”Cc” and “Bcc” fields (Party List) of Email Entity depending on “Email Behavior” option set field value.
I have 2 conditions here –
- Default E-Mail : should show all the entities records in lookup field as default behavior of field.
- E-mail To Contact or Users Only: should show only “Contact” and “User” entities records in lookup field and all others should be hidden.
Add function “filterOnLoad” at locations-
1. “onLoad” event of form with “Pass execution Context as first Argument” checked.
2. “onChange” event of “EMail Behavior” field with “Pass execution Context as first Argument” checked.
Publish your customization and here its done…
Please Note : for “From” field has different behavior than these all above fields. “From” field is lookup/PartyList for only “Users” and “Queues”.
You can refer My other blog post related to this one – Filter Required/Regarding (partylist data type) fields…
Hope this will help you.
Enjoy MS CRM!!!
One thought on “Set “Look For” for particular entities in Multi-entity Lookup Field like party List”
Thank you Prashanth