I have a synchronous/real time workflow that checks for a particular condition, and if that condition is met the workflow is cancelled. Obviously since it is synchronous, the changes are rolled back which is expected and needed.
The problem is, I need to collect and log either the record id or the record number (custom text field) from the record whose update was cancelled due to meeting the cancellation criteria. Ideally, the record number (custom text field) is of more value so that's really what I need to capture and log. The captured record number (custom text field) can be saved in a custom error entity if thats easier to do as a no-code solution, or it can be written to the Plugin Trace Log as a last/non-preferred option.
How can I EASILY and WITH NO CODE capture and log the record number (custom text field) when the record gets caught in the "forbidden" part of the workflow due to meeting the specified condition?
If code is required, and there is absolutely no way to do this without code, what do I need to do, exactly to achieve this objective?
I need to make sure the value of the record number (custom text field) is captured and written as a log entry or written to an error entity, even though the workflow will cancel and roll back the transaction.
Here is a screen shot of the portion of the workflow where I need to insert the item described above.
