Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Online 365: opportunity close trigger de-activate related records

Posted on by 2

Hi,

We have created a custom entity which has a reference to an opportunity.

When the opportunity closes, we need to change the status of the related custom entity records to Inactive.

It is however not clear for me on what plugin entity/message I could react.

Opportunity - SetState or OpportunityClose - Create(?).

What would be the best option, and why would one option be preferabel over the other?

*This post is locked for comments

  • Birgit RD Profile Picture
    Birgit RD 2 on at
    RE: Online 365: opportunity close trigger de-activate related records

    I used a plugin for the update message of opportunity, and it works fine.

    Hence I marked the answer from Alex as the one that helped me out.

    Thanks to everyone for your suggestions.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Online 365: opportunity close trigger de-activate related records

    Birgit,

    Potentially you can use workflow to handle change of opportunity state and cascade change of status to children using one of steps from my workflow toolkit - github.com/.../releases - you will need Relashionships - Cascade Status.

    Also if I'm not wrong you can resolve that task using relationship configuration itself because there is no setting to configure cascade of state/status.

  • Birgit RD Profile Picture
    Birgit RD 2 on at
    RE: Online 365: opportunity close trigger de-activate related records

    For relationship mapping one need to have a parential relationship and to my knowledge, there can only be one for an entity.

    I'll try with the Update message, and see how that goes.

  • Suggested answer
    Ryan Maclean Profile Picture
    Ryan Maclean 3,070 on at
    RE: Online 365: opportunity close trigger de-activate related records

    why don't you configure this in the relationship mapping between the opportunity and your custom entity? That would be the easiest method I would think

  • Suggested answer
    RE: Online 365: opportunity close trigger de-activate related records

    Hello Birgit ,

    If you require to write a plugin on stage change then user ."SetstateDynamicEntity"  message

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Online 365: opportunity close trigger de-activate related records

    Hi,

     I'd just try registering that plugin on the "Update" message for the opportunity entity - you will need to have a condition in your plugin code to verify if statecode attribute is in the "Target", and, then, to verify the specific value of the statecode (0 would be active, anything else would be closed)

    As to why, SetState request is deprecated:

    msdn.microsoft.com/.../microsoft.crm.sdk.messages.setstaterequest.aspx

     Why not on the OpportunityClose entity.. You can probably do it on the "Create" of that entity, too (if it allows for the plugins/workflows to be registered)

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,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans