Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Thread safe plugin execution

(0) ShareShare
ReportReport
Posted on by 170

I've developed a CRM plugin that communicates with an enterprise service bus (ESB). For some specified entities, on create/update/associate/disassociate events, the plugin sends data flow to ESB.

I have some issues on the disassociate event, when the plugin is executed multiple times at a time, it seems that the last execution takes the last state of the entity, as it is not considering the last disassociation. 

I know that a CRM plugin is not instanced every time it runs so I believe that the last execution is in concurrency with the previous as I make a RETRIEVE call on the target during the plugin process. 

How can I resolve that issue ? Is there a lock or something that I can use ? 

*This post is locked for comments

  • Suggested answer
    Radu Chiribelea Profile Picture
    Radu Chiribelea 6,667 on at
    RE: Thread safe plugin execution

    Hello,

    Do you have the execution context or organization service define as class members (outside of the Execute method) within your Plugin class? If so, i would change that and see if the issue still happens. CRM Plugins need to be stateless due to the reason you mentioned above

    Regards,

    Rad

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