Sunday, 12 October 2014

CRM 2013 Subgrid vs. (Expanded) Associated View Records

Have you ever experienced when you have subgrid in your CRM Form, but when you click the ‘expand’ button to expand the view then it will redirect you to Associated View, but you found the records appear in the list are different?

If yes, then you might need to read this post.

If not, then you could read this post as well just in case you encounter this issue in the future.

To more detailed info about the real situation in practice, you can check this forum post:


and


When you put the sub grid into the form and you put the Associated view in the Left Navigation area during customization in Form Editor, you can see the subgrid records and you can open to expand the view.

image

*I have 2 records

Then, you realize that your associated view does not have the same list


* I can only see 1 record, where is the other record?

Okay, let’s go to the Root of Cause.

1. When you place a subgrid in the parent entity form, you will choose the view, right? Is that the records from related record or not and also what view you use.

For example, you choose ‘Recent Opportunities’ and ‘Only Related Records’.

You want to display Opportunities from Account.


2. If you found the issue I mentioned in the very beginning, then you might check the relationships.

In fact, you have more than 1 relationship.


3. So, what’s about? I have 2 relationship, so what?

Okay, now imagine that in the Opportunity perspective, you will have 2 fields.

- Account from relationship number 1 (hereafter will called as Account A)
- Account from relationship number 2 (hereafter will called as Account B)

For the records that you created from subgrid or associated view (quick create form as well) anything you create and then you choose from Account ABC for example, it will auto populate Account A and Account B set to ABC, because the mapping will work for record created from parent entity (it is how CRM relationship mapping takes role as behavior) and CRM does not know which relationship will be auto-filled, relationship #1 or relationship #2, so that CRM auto-populate both of those Account fields.

However, it won’t work for those records which created from outside of the parent subgrid or associated view, and won’t work for update or for existing record, it will work only for new record created.

*So, for example you create a new Opportunity, then you set the lookup field on Account A to ABC and Account B to XYZ, yes, it is possible. (remember this statement)
4. From the last statement in number 3, I mentioned about the lookup fields that can be different even though comes from same entity, Account.

This is very clear that the related records in the view of Account ABC and Account XYZ perspectives will return different related opportunities records.

If you go to Account ABC based on the relationship number #1 vs. relationship number #2, you will get different opportunity records.

See this table as reference:

Opportunity Account A Account B
Opp1 ABC XYZ
Opp2 ABC XYZ
Opp3 ABC ABC
Opp4 XYZ XYZ
Opp5 XYZ ABC

So, now you are in Account ABC from the relationship #1, you will get 3 opportunity records, otherwise from relationship #2, you will get 2 opportunity records only.

5. Now what happened if you found the subgrid and (expanded) Associated View are showing different result.

Basically, in the subgrid, it will show all of the Recent Opportunity records related to Account ABC based on your selected view (you can choose the view based on which relationship)

Then, in your CRM you have 2 relationships Account – Opportunity and you put a subgrid plus 2 associated view:


I found that if you don’t have any Associated View listed in the navigation area, it will not allow you to click the ‘Expand’ button to go to expanded Associated View, this is the key of the investigation.
6. Okay, then when you click the ‘expand’ image button, it will open the Associated View and now you have 2 Associated Views, CRM will not ask you which one you want to go, relationship #1 or relationship #2? In fact, CRM will redirect you to one of the associated view by default.

7. So, for example you put the subgrid based on the relationship #1, it will return you 3 Opportunities,

image

but when you click the expanded view, it is possible will show you different result.
It is possible to show you only 2 records from relationship #2 (Opp3 and Opp5)

image

8. Okay, I am done with the explanation, let’s back to the root of cause and the solution.
The main reason behind this behavior is you have more than 1 Associated View and CRM can redirect you to different Associated View, not exactly redirect you to the View based on the subgrid you have.

CRM will redirect you to the Associated View by Order or in Sequence.

Solution:

1. If you think the relationship #2 is not important (since you put relationship #1 as the view in the subgrid), you can just remove the Associated View.

2. If you think solution number #1 is not appropriate, you can try another proper solution, you can just re-order the order of the associated view, for example you swap the position.



I found this similar question in some posts and I hope it can help you!

Thank you.

8 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Wow! Great post! The content is very rich, and I really like it. It help me very much to solve some problems. It is very helpful for all the people on the web. Thanks a lot. Ecommerce Product Photography || Ecommerce Product Photoshoot || Products Catalogue

    ReplyDelete
  3. Wow! Great post! The content is very rich, and I really like it. It help me very much to solve some problems. It is very helpful for all the people on the web. Thanks a lot. Ecommerce Product Photography || Ecommerce Product Photoshoot || Products Catalogue

    ReplyDelete
  4. Great post. thank you.
    But a searched for solution to different problem. I have a subgrid in some form, with custom view. not the "associated...". my custom view have another filtering condition, not only the association. and when i click "expand associated view" in my form, i get the system default associated view, of course without my own filtering. yes, i can click and change the view to one i want, but it is too much clicks for my client. maybe you can help me?

    ReplyDelete
    Replies
    1. Michael - did you sort this out - I have the same problem...

      Delete
    2. No, the problem is still existing. But now after 2 another years of exerience i can suggest to write a plugin for "Pre Retrieve Multiple" that will catch the expanded associated view execution and adding any filtering to it.

      Delete

My Name is..