0
votes

I am using Dynamics CRM online 2016 Update 1 .

I have a custom entity added to my solution named System. It has a lookup field that is linked to the Account entity. What I want to be able to do is restrict that lookup to only search for Accounts which have the Industry field set to a certain type.

Is this possible and if so, how would I go about it?

1

1 Answers

0
votes

Yes, it's possible to filter your lookup field using the PreSearch event.

The lookup control has a PreSearch event that occurs just before the control launches a dialog to search for records. There is no UI to set event handlers for this event. You must use the addPreSearch and removePreSearch methods on the lookup control to add or remove event handlers for this event.

Use this event with other Lookup control methods and events to change the results displayed in a lookup based on the form data current just before the lookup control shows search results for a user to choose from.

In this blog (Inogic) you can see a good example of it.