I used to think that lookup controls are using entity “lookup view”, but, it seems, I was wrong. It might be something that has changed along the way, or it might always work differently.. this way or another, it came out as a bit of a surprise earlier today when I was looking at V9.
Basically, when setting up a lookup control, there is an option to choose the default view.
It seems that’s exactly the view which Dynamics will be using as a lookup view.
Yes, it is definitely the view that shows up when I click “Look Up More Records” – that I knew:
What I did not quite realize, though, is that it’s the view which Dynamics is using as a lookup view when we start typing in the lookup control, for example:
Just have a look at the columns in my “accounts lookup view” and you’ll see that it’s not that view at all – there are no emails on the screenshot above, but it’s the second column in the lookup view:
Actually, it seems to be a bit more complicated than just searching in the default view. The way I understand it, here is what Dynamics will do once you have typed in a search string in the lookup control and clicked the search button:
- It will apply default view filtering conditions first
- It will extend those conditions with the “OR” filter on all the attributes added to the “find columns” of the lookup entity’s quick find view
- It will use default view column layout to display the results (3 first columns of the view will be displayed)
And it seems to be somewhat consistent with the description here:
Although, I’m not sure what it means when it’s been put this way:
“Lookup search results show the first three columns that are defined in the lookup view of the entity or the view that’s set as the default view of that lookup”
Based on the screenshots above, it seems that Dynamics will be using “default view” only.
Hi, it always shows the “Name” field as the first column, and after that the column 1 and 2 of the view that you set as LookUp View, very tricky
the lookup view is used as a default view for lookup filtering when the lookup control is first added to the form, but is also capable of referencing other views (wherein the primary field and first two other columns will be displayed).
Hence; “Lookup search results show the first three columns that are defined in the lookup view of the entity or the view that’s set as the default view of that lookup”.
I agree, the wording is not clear.
Thanks for some excellent blog posts !
i want to change dynamic label in edit filter criteria of view. I select Account entity with equal condition , but after that i want to pass dynamic value or account name. can you tell me how i can customize it through coding or any other method?
Hi, you can’t use dynamic values directly in the “advanced find”. The only workaround would be to create a plugin on RetrieveMultiple (and register that plugin in pre-operation) to update the query before it’s executed. For an example of such a plugin, have a look at this post: https://www.itaintboring.com/dynamics-crm/powerplatform-when-a-plugin-meets-a-canvas-app/ (there is a link to a github repo there)