Dynamically set FetchXml to subgrid on Dynamics 365 V9 (UCI)
A client asked to list the compaigns for a given contact. the first thing to do was to understand the relationship between the two entities. Bad luck, the two entities don’t have a direct relationship. In fact , we have a many-to-many relationship between contact and marketing list and the same for Marketing List and Compaign.
A first approach was to manually list the list of compaigns for a given contact with the advanced find, and download the corresponding fetchXml
Okay, now that we can get the list of compaigns for a contact manually, let’s try to automate things. One thing is to put the subgrid of all compaigns in the contact form.
The next step is to set a new fetchXml to the subgrid that depends on the contact. Let’s do this with some JS. Keep in mind that this approach is not supported by Microsoft…
this javascript works very well in the classic interface. But errors are raised in the unified interface, let’s resolve this.
First, we need to add a filter to the view.
I used a solution provided by Dmitry Titenko in https://community.dynamics.com/crm/f/117/t/299697?pi61802
Remember this solution is not supported by Microsoft. Another approach is to use a plugin… I’m still looking for the solution. How we can pass the contact via a message to the Back-End ??
