Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

SubGrid display related records using two fields on related entity

Posted on by Microsoft Employee

Vanilla Dyanmics allows me to set a subgrind on a record, account, to show all incidents related through a field, Customer.  I want to be able to using that same sub grid, also show records where that related account is also listed in a custom field on the incident record, End User.  

It's the same related entity, just a second field to look at.  Cases(End User).  My other option is two grids, which I'd prefer not to do.

Is this as simple as exporting the solution and just tweaking the xml?  Not sure if anyone has done this before already, and if there is an easier way.  Or if even tweaking the code will work.

*This post is locked for comments

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: SubGrid display related records using two fields on related entity

    Hi Clinton Booze,

    Make sense. Thank you.

  • Bahalzamon Profile Picture
    Bahalzamon 215 on at
    RE: SubGrid display related records using two fields on related entity

    Why am I needing to create a question? Create a duplicate question? That is usually frowned upon...

    I am providing an update URL for a "Verified" answer in an attempt to help other people experiencing the same issue.

  • Bahalzamon Profile Picture
    Bahalzamon 215 on at
    RE: SubGrid display related records using two fields on related entity

    Why am I needing to create a question? Create a duplicate question? That is usually frowned upon...

    I am providing an update URL for a "Verified" answer in an attempt to help other people experiencing the same issue.

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: SubGrid display related records using two fields on related entity

    Hi Clinton Booze,

    You should need to create a question in the forum with your details. 

  • Bahalzamon Profile Picture
    Bahalzamon 215 on at
    RE: SubGrid display related records using two fields on related entity

    Looks like the link no longer works, dug around and I think this is the correct URL now: jonasr.app/.../  as the month/year and name are pretty much right on. :)

    Unfortunately it looks like he removed all the images or most likely they got re-pathed and not updated.

    I am going to still attempt to try this, but if you happened to find an easier way please let me know. I went to the site and watch an hour long zero to hero video that I learned nothing I didn't figure out by poking around int he Toolbox plugin. :(

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SubGrid display related records using two fields on related entity

    I did not find an easier way.  Allison's way should work, just follow her suggestion.  I did not try it yet as priorities were shifted here to something else.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SubGrid display related records using two fields on related entity

    Hi
    I have custom entity.

    I want to show the sub grid with with filtering two or three fields that all are look up.
    In SQL way I want to select * from table where field 1 = *** or field 2=*** or filed 3 =***

    I read your post it was similar to my issue did you find any answer to to your post?

    would you share your info and help me to solve this?

  • awalters Profile Picture
    awalters 3,079 on at
    RE: SubGrid display related records using two fields on related entity

    No problem!  And if you find something simpler, definitely link back to it here - I'd be curious if it would work for our scenario as well.  :-)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SubGrid display related records using two fields on related entity

    [quote user="Allison Walters"]

    Your scenario is a bit different than mine, so there may indeed be a simpler way to handle it (maybe a solution tweak, like you suggest).  I can point you at a way that would work, but takes some development experience and would potentially be overkill if there actually is an easier way to handle it.  :-)

    Essentially, what you can do is have a plug-in that intercepts the query being used to populate the subgrid and modifies it before sending it onwards.  Jonas Rapp gives an example (plus a sample solution and source code) here - http://jonasrapp.innofactor.se/2016/04/all-activities.html

    I was able to use this (and the part 2 companion article) to create a subgrid for activities that shows activities an entity is directly tagged in, or ones they're linked to via a separate custom entity we've created.  So it does feel like you'd be able to make it work for your case as well.  I've played with plugins a bit, so with his sample code it wasn't too bad - only took a couple hours to modify the code.  Actually took longer to figure out the fetchXML, because I wasn't familiar with Fetch, and there are a variety of limitations around joins, etc...  But your query seems less complex, since you're just working with a custom field on the same entity, rather than an additional entity altogether.

    [/quote]

    Not too shabby.  This looks like it will work.  I was hoping not to have to write a plugin as a direct code edit would be less resources on the page, but looks like it directly will solve my issue.  I'll keep digging, but it's nice to know this will get me where I need to be.  Thanks.

  • Verified answer
    awalters Profile Picture
    awalters 3,079 on at
    RE: SubGrid display related records using two fields on related entity

    Your scenario is a bit different than mine, so there may indeed be a simpler way to handle it (maybe a solution tweak, like you suggest).  I can point you at a way that would work, but takes some development experience and would potentially be overkill if there actually is an easier way to handle it.  :-)

    Essentially, what you can do is have a plug-in that intercepts the query being used to populate the subgrid and modifies it before sending it onwards.  Jonas Rapp gives an example (plus a sample solution and source code) here - http://jonasrapp.innofactor.se/2016/04/all-activities.html

    I was able to use this (and the part 2 companion article) to create a subgrid for activities that shows activities an account is directly tagged in, or ones they're linked to via a separate custom entity we've created.  So it does feel like you'd be able to make it work for your case as well.  I've played with plugins a bit, so with his sample code it wasn't too bad - only took a couple hours to modify the code.  Actually took longer to figure out the fetchXML, because I wasn't familiar with Fetch, and there are a variety of limitations around joins, etc...  But your query seems less complex, since you're just working with a custom field on the same entity, rather than an additional entity altogether.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans