Greetings Dynamics gurus,
I inherited a synchronous Pre-operation server plugin on email create where I want to NOT send an email if we've already sent the user too many emails. In the case where the plugin is not supposed to send an email it needs to put a record in another entity but it is using the same service provider. In our current implementation it seems the only way to allow the save in the other entity but prevent the email from being sent is to throw an exception after logging the email attempt, this has the undesired effect of plugging up the tracelog with loads of plugin failures that are not actually failures.
My first question is how it possible that throwing the exception after logging the attempt does not cause the entire transaction including the logging of the event to roll back? Am I not in a transaction at this point? Is a separate transaction being spawned on the same service provider for the log attempt and because its on a different entity than the entity initiating the plugin that is causing it to function?
My second question is: Is there a way to accomplish what I've described about without throwing an exception but still causing the logging to occur and the email not to get sent and without an exception using an email create plugin registration?
Thanks,
Steven
Hello,
You can avoid the roolback by using actions.
I did not understand your problem...can you please screenshot your plugin's steps and your code ?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156