Reputation: 5455
We have written plugin for Microsoft CRM that is run after an entity is created, and ideally we would like it to run after it has been saved to the database as well. If we set it to process synchronously it fires before our database trigger has had time to modify the entity record.
If we set the plugin to process asynchronously is it assured to have been saved to the database before the plugin is fired, or is there a possible race condition there?
Upvotes: 0
Views: 727
Reputation: 6629
Did you set your own triggers on CRM database tables ? It is not advisable to do so; all operations on the database should be done through the CRM webservice to ensure you're not breaking anything. Also, custom triggers are not guaranteed to survive when CRM Update Rollups are installed. You should always use plugins instead.
Other than that, an asynchronous plugin only fires after the database update is through, as does a synchronous plugin in the post stage; the difference is that the operation (CRM webservice call, saving the CRM form etc.) does not block until the plugin has run, so in the case of saving a record's form, the form will not usually reflect the changes an asynchronous plugin makes because the plugin has not run when the form starts reloading after the postback.
Upvotes: 3