Managing V6 workflow for classes

The workflow engine used in V6 is based on V6 development models such as "V6 objects" (described by GESAOB function).

In V7 and the following upgrades, a new type of development uses classes and representations in object mode. The V6 workflow engine does not handle events on classes or representations. This will be possible in a future upgrade with a new workflow engine. Currently, it is possible, from a V7 code associated with a class, to trigger a workflow event through dedicated APIs.

These APIs are located in ASYRWRKCLASSIC library. Their execution is based on batch tasks. This means that using these APIs to trigger a V6 workflow event execution from code associated with a class creates a batch task request. The batch server executes V6 code to handle the workflow.

The corresponding batch task is called AWRKCLA.

Some limitations exist in the workflow event called in that way:

Call a workflow event

The function is located in the ASYRWRKCLASSIC library. Its definition is the following:

Funprog WORKFLOW(ACTX,TYPEVT,CODEVT,OPERAT,CLEOBJ,REQUEST,MESSAGE)Variable Instance ACTX Using =[V]CST_C_NAME_CLASS_CONTEXT : # Context where the errors messages are storedValue Integer TYPEVT : # Workflow type event (local menu #988) : only 1,2,10 are possibleValue Char CODEVT : # Event codeValue Char OPERAT : # Operation (operation codes C=creation, M=modification, or a "button" code)Value Char CLEOBJ : # Object key for object eventVariable Integer REQUEST : # Returns the ID for the batch request createdVariable Char MESSAGE : # Message returned by the workflow post

This function has to be called in the scripts associated with the class or the representation to implement a workflow call.

For example, for the TABCOUNTRY class, if you want to call all the workflow events based on a modification for object TCY (the V6 object that stores countries), then in the TABCOUNTRY_CSTD script, on the 'AUPDATE_AFTER' event, you add the following code:
$AUPDATE_AFTERLocal Integer REQNUM,TYPEVT,STATLocal Char CODEVT(30)Local Char OPERAT(30)Local Char MSG(250),CLEOBJ(250)TYPEVT=2 : # Object based eventCODEVT="TCY" : # The object is TCYOPERAT="M": # ModificationCLEOBJ=this.CRY : # Current keySTAT = func ASYRWRKCLASSIC.WORKFLOW(this.ACTX,TYPEVT,CODEVT,OPERAT,CLEOBJ,REQNUM,MSG)Return
If, for the TABCOUNTRY class, you want to call all the workflow events based on creation for object TCY (the V6 object that stores countries), then in the TABCOUNTRY_CSTD script, on the 'AINSERT_AFTER' event, you add the following code:
$AINSERT_AFTERLocal Integer REQNUM,TYPEVT,STATLocal Char CODEVT(30)Local Char OPERAT(30)Local Char MSG(250),CLEOBJ(250)TYPEVT=2 : # Object based eventCODEVT="TCY" : # The object is TCYOPERAT="C": # CreationCLEOBJ=this.CRY : # Current keySTAT = func ASYRWRKCLASSIC.WORKFLOW(this.ACTX,TYPEVT,CODEVT,OPERAT,CLEOBJ,REQNUM,MSG)Return

Call a manual workflow event

The function is located in the ASYRWRKCLASSIC library. The call is simplified for manual workflows so there are fewer parameters to send:
Funprog WORKMANUAL(ACTX,CODE,FILTER,SIMUL,REQUEST,MESSAGE)Variable Instance ACTX Using =[V]CST_C_NAME_CLASS_CONTEXT : # Context where the errors messages are storedValue Char CODE : # Event codeValue Char FILTER : # FilterVariable Integer REQUEST : # Returns the ID of the batch request createdVariable Char MESSAGE : # Message returned by the workflow post

Extended workflow event call

The function is located in the ASYRWRKCLASSIC library. This call has additional parameters and is supplied for compatibility reasons only. Some parameters are no longer used:
Funprog WORKPLUS(ACTX,TYPEVT,CODEVT,OPERAT,CLEOBJ,CODE,SIMUL,DIFFERE,TYPDEC,GRPDEB,REQUEST,MESSAGE)Variable Instance ACTX Using =[V]CST_C_NAME_CLASS_CONTEXT : # Context where the errors messages are storedValue Integer TYPEVTValue CharCODEVTValue CharOPERATValue CharCLEOBJValue CharCODE : # Workflow (in case of W button and manual workflow)Value Integer SIMUL : # Allows to simulate or to generate a manual workflowValue Integer DIFFERE : # delayed message sending (object creation / update transaction)Value Integer TYPDEC : # Workflow triggering before/after update [F] in object workflow - obsoleteVariable Char GRPDEB : # first group chrono (used for delayed send)Variable Integer REQUESTVariable Char MESSAGE

Note

The workflow events based on V6 objects or V6 events continue to be executed from the object if classic code is used. The difference between classic execution and class/representation execution is that in classic code, the execution is always triggered; while in class/representation, this execution is only triggered if the previous API has been integrated on the correct events in the scripts associated with classes or representation.

If you want to prevent a workflow event from being executed in classic mode on an object, the value of GFONCTION can be tested. It is only filled for a classic execution with the GESXXX value, where XXX is the object code.