# Example - Workflow processing

An extension exists to process workflow tasks. In a workflow, individual person nodes can be created for the ELOas account. If a workflow activates this node, an ELOas "WORKFLOW" search can be used to find and process a list of the active workflow tasks. This can be used to add the metadata and forward the workflow.

The necessary rulesets must be created at the XML level.

Collecting the workflow task list is essentially the same as a normal search. Enter "WORKFLOW" as the metadata field name. The search term itself will be ignored and should remain empty.

<base>
    <name>Workflow2</name>
    <search>
        <name>"WORKFLOW"</name>
        <value></value>
        <mask>13</mask>
        <max>1000</max>
    </search>
    <interval>1M</interval>
</base>

Even if a search form is not required to collect the list, a search form must still be specified. From the list of tasks, only those workflows will be processed that have this form. This is necessary in order for the index data to be able to be loaded in the local JavaScript variables. If a workflow should be able to use more than one form type, the ruleset must be entered multiple times.

Information

In the list of deadlines, no "FindFirst – FindNext" action will be performed. If there are a number of tasks that will not be processed, this can lead to no new tasks being found for actual processing.

When processing workflows, there are two activities in addition to changing the metadata: forwarding and changing the workflow. The following example shows how the workflow can be influenced depending on the current metadata. In addition, a simple approval workflow will be examined, for which the person processing it is not clear at the start. This person will be entered in the course of the workflow to the PROCESSOR index field by the mailroom department. In the template, the processor node is first initialized with Owner. The correct value is read from the PROCESSOR index field at runtime, then entered to the node. ELOas then runs under the ELO name elowf with a person node between the mailroom and the claims processor.

Workflow designer, workflow template with ELOas

Fig.: Workflow designer, workflow template with ELOas

When the workflow arrives at ELOas, the mailroom will have defined the claims processor. ELOas reads the PROCESSOR metadata field and enters the value to the Processor successor node. This takes place through the following simple rule:

<rule>
    <name>Expand Name</name>
    <condition></condition>
    <script>
        log.debug("Process WF: " + NAME);
        wf.changeNodeUser("Employee", EMPLOYEE);
        EM_WF_NEXT = "0";
    </script>
</rule>

Changing the ELO user name is performed by the wf.changeNodeUser command. Enter the workflow name as the first parameter and the ELO user name as the second. The library wf takes care of the rest (locking the workflow, searching for the node, refreshing users, saving the workflow, releasing the lock).

After the user name has been set, the workflow has to be forwarded. This takes place by setting the variable EM_WF_NEXT. If left empty, nothing will be forwarded. The task remains the same (which should not remain as is forever, as at some point the list of deadlines will overflow). Once all conditions for forwarding have been met, then either the connection number or the name of the successor node can be specified. If there is only one successor, then the connection number can be entered: EM_WF_NEXT = "0";.

If there are multiple successors, the name of the successor node should be entered instead. It will also be assumed that the process will automatically be booked after the person processing it has forwarded it, meaning the accounting node will also be transferred to ELOas. This runs a script that audits the accounting data. If the script runs successfully, the function ERPverify() will return true and the workflow is forwarded to the Charge account node. If an error occurs, the workflow is returned to the claims processor. The script could then look like the following:

If (ERPverify()) {
    EM_WF_NEXT = "Book";
}   else {
    EM_WF_NEXT = "Employee";
}
Last updated: September 26, 2023 at 7:46 AM