web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Online 365: opportunity close trigger de-activate related records

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Verified answer
    ashlega Profile Picture
    34,477 on at

    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)

  • Suggested answer
    gupta.ambar2009@gmail.com Profile Picture
    797 on at

    Hello Birgit ,

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

  • Suggested answer
    Ryan Maclean Profile Picture
    3,070 on at

    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

  • Birgit RD Profile Picture
    2 on at

    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
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    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
    2 on at

    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
JS-09031509-0 Profile Picture

JS-09031509-0 3

#3
Ciprian  P Profile Picture

Ciprian P 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans