The key is this: the action is attached to the approval process. So when the process completes successfully, the action will be processed automatically. If the process doesn't complete (i.e. it's rejected at some point) then the action is naturally not processed.
So the action functionality presents a very powerful and flexible way to control actions taken. You can easily specify and parameterize an action as an arbitrary request, then build and change permission structures as necessary as your needs change.
<action action="procadhoc" handler="wftk" process="42"> <task ...> </action>The
procadhoc
action of the wftk action handler attaches ad-hoc workflow to the identified process. The content of an action
structure is arbitrary; the action handler should do with it whatever is appropriate. Many actions will have no content:
<action action="procstart" handler="wftk" process="chair"/>As of this writing (May 17, 2001) I've got two action handlers; the wftk handler encapsulates some of the wftk API itself, and the system handler encapsulates system calls. The system handler is very raw. Anyway, neither of them is well-documented, so that's yet another thing I need to come back to later. Please bother me about it if you would. Thanks.
int wftk_action (void * session, XML * action);
int
Not a lot needs to be said about the actual function beyond what you see above. You build an action structure using the XMLAPI, you allocate a session, and you call the function. The return code of the function is nonzero on success, and the action structure itself will be decorated with diagnostic information in the status and status.reason attributes. The status attribute will be "ok" if the action was taken with no approval necessary, "no" if no action was permitted, or "deferred" if an approval process was started. The status.reason is supplied in the permissions database and is arbitrary but a nice thing for user interfaces to display.void * session,
XML * action
If the action is deferred, then the action structure is further decorated with attributes dsrep
and process
, which
encode the actual process started.