When configuring a CRUD activity, you can choose whether to suppress errors encountered by that activity. The following option is available: Continue workflow even if this activity encounters an error.
If this option is not selected (default setting), then an error condition encountered by the activity causes ActiveRoles to terminate the whole workflow. If you select this option, the workflow continues regardless of whether or not the activity encounters an error condition.
You can have the workflow take an appropriate compensation action. This could be accomplished by using an If-Else activity with a branch condition that evaluates the "Encountered an error" execution status of the CRUD activity.
Add an If-Else activity following the CRUD activity and configure a condition on an If-Else branch to detect the "Encountered an error" execution status of that CRUD activity. Then, configure that If-Else branch to contain the activities you want to perform the compensation action.
Then, configure that If-Else branch to contain the activities you want to perform the compensation action.
As a result, once the CRUD activity has encountered an error, the "Encountered an error" branch condition evaluates to TRUE causing the workflow to execute the branch of the activities intended to perform the compensation action.