Reputation: 103
everyone! I have an issue with creating custom criteria for sub-grid view for Dynamics CRM.
I have 3 Entities, let's call them "Companies", "Customers", and "Surveys".
"Surveys" Entity has field "Score" that contain decimal score of Survey Responses.
On "Customer" entity I print a chart with avg score of customer Surveys:
test_C_1 is a Company name
test_B_1 is a Customers name
test_A_1 is a Survey name
But I need the same table + avr chart on the Company entity.
I successfully join the table, but I can`t filter the table for the current (selected) Company. I get the all results and the chart give me the wrong AVR score.
My wish is to get all "customers with all Surveys" that are related to the current Company.
What is the best method to clear the table from redundant information?
P.S. I need this for Dynamics Versions 7.0 and for the latest version 8.2.
Thank You very much!
Upvotes: 1
Views: 734
Reputation: 1499
The problem is the "related records" functionality only jumps 1 level so it will only work on the customer entity. There are a couple of ways to work around this, but the easiest in my opinion is to denormalise the customer -> parent company onto the survey entity. So on survey you'll have a lookup to both the customer and the company.
Next, you can utilise an attribute mapping to copy down the parent company onto the survey. This will auto fill the survey -> company field when you create surveys from a customer record.
For the other times where surveys are created standalone (and you just select the customer manually) my recommended way to solve it is write a plugin (on pre-operation). The plugin will grab the parent company from customer record and populate it on the survey for you.
If you can't write plugins, a workflow that fires on create of a survey would suffice. It can grab the survey -> customer -> parent company and set the relevant field on the survey.
Once you have done all that filtering a grid / chart by related records should now work.
Another way, which I am not going to go into in much detail due to being slightly more cumbersome, is to override the FetchXML that is passed into a grid on the form... it works, but I think the plugin/workflow way is cleaner.
Upvotes: 2