Filter Required/Regarding (partylist data type) fields using JavaScript in Dynamics 365 / MS Dynamic CRM

What is Issue?

Sometimes we need to filter out the lookup fields according to business requirement. So generally we try to apply custom filter using client side scripting (JavaScript). This filtration works for normal lookup fields (datatype Lookup), but when it comes to fields like Regarding object,Required,Optional fields (PartyList Datatype fields) on Activity forms(Appointments/Phone call) the script fails. It won’t filter the field continues to show default results for Accounts .

The Reason-

You will face this issue because the party list shows the results for all the entities like Accounts, contacts, lead,User and depending on the entity selected in “Look for” in Lookup More result window.

Solution-

The Solution for this issue is to set the “Look For” value before filtering the lookup to limit the search according to business requirement. Use the following code to set the “Look For” in Lookup More Window-

LookFor

This will set Look For as well as will apply the custom filter to your field.

Enjoy MS CRM!!!

One thought on “Filter Required/Regarding (partylist data type) fields using JavaScript in Dynamics 365 / MS Dynamic CRM

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 )

Facebook photo

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

Connecting to %s