Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to update one of two subgrid with thesame regardingId on a form

Posted on by 390

 I have two subgrids(the same child entity) on a form, I am meant to update  one subgrid programmatically and not the other. I know i need to retrive the regardingId and update the regarding, but like i said, I want to just update one of the subgrid and not the other. The code i have written updates all the subgrid because they all have same regardingid and it being thesame entity. Is there anyway i can tell the dynamics API to update only the records in one subgrid and not the other?

*This post is locked for comments

  • Victor Onyebuchi Profile Picture
    Victor Onyebuchi 390 on at
    RE: How to update one of two subgrid with thesame regardingId on a form

    chikhaleankush Certaining there is, there views in the subgrids are filtered diferently. Thanks for the heads up.

  • Verified answer
    chikhaleankush Profile Picture
    chikhaleankush 547 on at
    RE: How to update one of two subgrid with thesame regardingId on a form

    I believe I understand.

    As you have 2 sub grids of same entity, obviously they will have same regarding.

    Now I want to know how can we (You) as developer differentiate records from grid 1 and gird 2.

    As mentioned previous in my answer there might be some special criteria like active contacts or inactive contacts.

    If we know the difference we can restrict update only few records.

    Again ex: subgrid 1 has 5 records subgrid 2 has 6 records. ( I assume all there 11 records are unique i.e they are not same, they have unique Guid)

    Currently your code updated 11 records but you want only 5 to be updated. Once we know the criteria we can restrict to no update those rest 6 records.

  • Victor Onyebuchi Profile Picture
    Victor Onyebuchi 390 on at
    RE: How to update one of two subgrid with thesame regardingId on a form

    chikhaleankush what i meant is, i have written a code that, on the click of a button(two option), i want to update a field of all the child records on one subgrid and not the other. The code i have written get the regardingid of the child record that equals the parent record (in your example the Main Account) and update the field i want, but it is also updating the second subgrid, because its regardingid is also the Main account. I hope you understand now. So what i want is how to tell dynamic Api using code to not update the second subgrid only the first one?

  • chikhaleankush Profile Picture
    chikhaleankush 547 on at
    RE: How to update one of two subgrid with thesame regardingId on a form

    Let me understand your questions, When you mean update subgrid, you indirectly mean Record from that subgrid right? i.e either you create new record or you update existing one.

    Now when you have 2 subgrid of same Entity, You have choice to show different view in these 2 subgrid.

    Let's take an example:

    Main Entity Account has 2 subgrid for Contact.

    Now you can keep 1 subgrid for Contact as "Active Contacts" and 2nd subsided as "Inactive Contacts"

    What will happen is that those 2 sub grid point to same contact entity but shows different record.

    But if you have same view on both sub grid irrespective of where you update if they show same records, it will be updated/refreshed.

    I believe this helps.

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans