Workflow Design: Update a process data from an external application


#1

Process data associated to a request can be updated via a workflow action (human or system-based) or via the web services API. The web services API solution is described in the Web Services API: Update Process Instance Data topic. This article will focus on the workflow action solution.

The usage of a workflow action is required for security and traceability reasons. Sometimes an external application has to update process data associated to ongoing requests. The solution below describes how to do this.

In this example we’ll update a process data called MYDATA (TEXT datatype) by using the web services API.

Step 1: Create a process data

Create a TEXT datatype process data with the name MYDATA.

Step 2: Create a new workflow application

  • Name: UPDATE_DATA

  • Description: Update process data

  • Application type: Asynchronous web service

  • URL: A valid URL to an empty HTML page secured with IIS Basic Authentication (form authentication is not supported).

  • Username password: A valid account with the required access rights to the previous URL.

  • Parameters: Optional; it is not required to add parameters in this case.

Step 3: Create a new workflow action in your process

  • Application: Select the UPDATE_DATA application

  • Name: UPDATE_MYDATA

  • Description: Update My Data

  • Action parameters: Parameter PARAM1, receive value into data MYDATA

You can link this UPDATE_MYDATA action to the workflow start point to instantiate the UPDATE_MYDATA action when a request is launched.

Step 4: Launch a request

Launch a request. You should have the UPDATE_MYDATA action instantiated with the open status.

If UPDATE_MYDATA is cancelled, you can have the details of the exception triggered in the action follow-up form (the URL is incorrect or there is a security issue).

Step 5: Call the WS API

Call the CompleteActivityInstance web method to complete the UPDATE_MYDATA action. The web method parameters are:

  • processInstanceId: Request number

  • activityInstanceId: Action number in the request

  • WorkflowContext: XML string that contains the parameters to send to WorkflowGen

The following is an example of WorkflowContext:

<NewDataSet>
    <parameter>
        <name>PARAM1</name>
        <dataType>TEXT</dataType>
        <direction>OUT</direction>
        <textValue>My value</textValue>
    </parameter>
    <session>
        <processInstanceId>12241</processInstanceId>
        <activityInstanceId>2</activityInstanceId>
    </session>
</NewDataSet>

Note: If needed, you can retrieve the WorkflowContext associated to an ongoing action with a call to the GetActivityInstanceContext web method.

After the CompleteActivityInstance call, the UPDATE_MYDATA action is completed and the MYDATA process data is updated with the value My Value.

If other process updates are needed for the MYDATA process data, you can add a loop on the UPDATE_MYDATA action with a condition on a LOOP_UPDATE_MYDATA new process data. This LOOP_UPDATE_MYDATA process data value can be updated by the UPDATE_MYDATA action via the WS API call. This way, you can control whether or not another process update is possible.


Web Services API: Update Process Instance Data