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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

is plugin execution synchronized for delete message over multiple records?

(0) ShareShare
ReportReport
Posted on by 55

I am new to Dynamics CRM and I could not find any information so far that would apply to my scenario. We have a Program entity that can have/reference multiple program dates entities, and each program date can have/reference multiple event entities. We have a view displaying all events associated with the program, and on the program form we want to display in a text the total number of events. From the view user can select multiple events then click delete button. This is a button that comes with CRM, not a custom one.

If I create a plugin for Delete message on event entity and want to query both program and Program date filed that keeps the total number of events then subtract one I am not sure these plugins will execute in sequence or concurrently thus having a race condition.

Now using javascript I also do not know if it is possible to read entity records PK and hook up into the pop up Confirm Deletion dialog box and execute after that a web service call

Any ideas?

Thanks Dan

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Hosk Profile Picture
    on at

    it's possible to make the plugin code thread safe but this won't work if you have multiple CRM servers (e.g. it's only thread safe on each server)

    you could trigger and update on the record hosting the other entities.  After the users delete the records you could set an update field.  then this plugin could just count the number of records.

    or

    you could have some javascript on the form which also counts the number of records linked to the entity.

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    Hi,

    If you register your plugin on the Post Operation Delete  step then you can safely update the parent record inside the transaction which will take out a lock on that record. You would only get a race condition if the update then caused another delete.

    See msdn.microsoft.com/.../gg327941.aspx

    Hope this helps,

    Scott

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans