Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Change one entity filed value when change of another entity filed value

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have 3 entities.

1. Contract  ---> filed , Org Name, current Members' Name list , Members' History list etc

2. Contact --> Member Name, Org Name , Committes' name, etc

3. CommiteeMemebership---> CommiteeName, Org Name, Members' Name

Requirement is when someone change the  Org Name in Contact entity for a Member eg Member "A" from org x to Z, then  I want to remove Member "A" from the current member list in Org X and Add Member "A" to  Members' history list in Org X and then Add Member "A" name in to Current member list in Org Z.

Also I want to change the Org name for the member "A"  in the committeeMemebership from X to Z.

Can someone please help me on this.

*This post is locked for comments

  • Suggested answer
    khoait Profile Picture
    khoait 450 on at
    RE: Change one entity filed value when change of another entity filed value

    Hi Dineth,

    I would create a plugin for this case. The plugin should be triggered on (pre-operation or post-operation) update message of Contact entity and filter for "Org Name" field change only. Also create an pre/post image to get the Org Name before and after update.

    In the plugin code, use Associate/Disassociate request to add/remove the Contact from Member lists of the previous Contract and the new Contract. Finally, query for the Committee record and use update request to update its Org Name.

    For Associate/Dissociate request, refer: msdn.microsoft.com/.../gg309247.aspx

    For Retrieve and Update request, refer: msdn.microsoft.com/.../gg334754.aspx

  • Dineth Profile Picture
    Dineth on at
    RE: Change one entity filed value when change of another entity filed value

    Thanks Rawish and Aric,

    I ll try this tonigh and let you know.

    Aric--> yest there is 1-N relationship between Contact and Committee. Yes I want to keep historical data.

    Contract entity is the Organization enetity.

    Thanks.

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Change one entity filed value when change of another entity filed value

    To Add to Rawish's answer.

    The associate/disassociate are in order to add/remove members from Marketing List from example, but It seems like you are trying to remove the data here from the Committee Membership record, which I think has a 1-N relationship between Contact and Committee. Is that correct.

    If that is the case, then you will need to either Deactivate the Committee Member record for the changed Contact, and create a new one (this is in case you would like to keep historical data). If you don't need to keep a history of the records, you can probably just change the lookup value in the Committee Member record, and that will automatically stop showing in the relevant lists.

    Also, in your description above, what is the Contract Entity. Is that supposed to be Organization?

    Hope this helps, and that it is not too confusing.

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Change one entity filed value when change of another entity filed value

    Hi Dineth,

    You can definitely do that using web api, on some condition , fire associate action using web api and some condition fire disassociate action :

    kindly refer to below blog from Mahender :

    community.dynamics.com/.../writing-associate-amp-disassociate-request-using-web-api

    mark my suggestion as verified if helpful to close the thread

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans