Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Changing presearch filter/view when another lookup field changes

(0) ShareShare
ReportReport
Posted on by

Hello, 

To start, I have three tables that are involved in this: Patients, Collections, Specimens and the relationships are as follows:

Patients 1:N Collections

Patients 1:N Specimens

Collections 1:N Specimens

Specimens 1:N Specimens (hierarchical)

I do it this way because sometimes we are able to relate specimens to collections, but other times we do not have that information and need to be able to just link to a patient. 

On my specimen form, I have a lookup field for 'Related Patient', 'Related Collection' and 'Parent Specimen' and I am trying to set up custom view for these lookups based on the values in them. For example, if the 'Related Patient' field has a patient selected, I want the 'Related Collection' field to only show Collections for that patient. I have been able to get that working within issue using addPreSearch and addCustomView. However, the issue I am having is for the 'Parent Specimen' custom view. 

My logical needs to be this:

If 'Related Patient' is selected && 'Related Collection' is selected, show only Specimens with the matching 'Related Patient' & 'Related Collection' (or just the 'Related Collection' which would get me the same result)

If 'Related Patient' is selected && 'Related Collection' is NOT selected, show only Specimens with the matching 'Related Patient' (irrespective of any Collection).  I have set up my fetchXml to take these things into consideration and I know that the script is inherently correct. The issue comes when I attempt to change the value in the Related Collection lookup. Initially, it will show me the correct specimens for the Related Collection, but if I change that Related Collection to a different collection, the view does NOT update the correct one. If I select "Advanced Find" and bring up the larger dialog window it WILL display the correct custom search. So there appears to be an issue with refreshing the quick search UI (whatever it is called) when the custom view changes (sometimes, I can see the correct search results for a split second but then it goes back to the previous one). 

So is there something that I need to add to refresh that ui element or will I only be able to see this change by saving and refreshing the record? Alternatively, is there a way to skip the quick search and directly open the Advanced Find dialog window?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans