I'm hooking et_FORM_DATA_ADD event (BeforeAction = true). I thought that SBO called this event just before a Form would be added to the system. I'd like to make a certain check in the FORM_DATA_ADD handler and by setting BubbleEvent = true to allow the Form adding, or by setting BubbleEvent = false to stop the Form adding.
In practice the FORM_DATA_ADD event means that the user wants to add a Form, but for various reasons the Form may not be added. For example the approval process starts after FORM_DATA_ADD and the user may cancel the authorization request and the form adding altogether. This is not acceptable.
Which event(s) (if any) can be used to build the following workflow?:
1. The user wants to add a Form (document).
2. The add-on intercepts this and tries to make action 1 (A1)
3.1 if A1 succeeds, allows the document to be added in the system and it is added.
3.2 if A1 fails, blocks the document and tells the user why.
My problem is that in 3.1 it is not guaranteed that the document would be actually added in the system and I cannot rollback A1. Also because A1 is not guaranteed to succeed I have to make it before the document is added not after.