Reputation: 870
I need to cancel an operation of creating a new entity record from inside a CRM plugin without throwing an exception.
Is there a way of rollback the transaction inside Dynamics CRM plugin without throwing exception?
Upvotes: 2
Views: 2458
Reputation: 18895
Create a Custom Action that you then call from the workflow that has a plugin in it that basically determines if the record should be created or not. If it should, it creates it, if it doesn't it just exits.
This way you don't have to throw an exception, and you can give it a good name "ConditionallyCreateFoo".
Upvotes: 2
Reputation: 195
The design of triggering a workflow which in turn invoking a plugin is not so good. You could use a custom workflow and write the same logic of your Plugin into this workflow and handle the exceptions.
Upvotes: 0
Reputation: 7918
No, you can only undo this by deleting the record within the same transaction.
Upvotes: 2