Open a Work Item Associated with a Pageflow

This topic includes an example that shows the sequence of calls that a client application should make to open a work item associated with a pageflow.

Note: The following description corresponds to the process shown in the diagram. The descriptions are from the perspective of the REST API. The process of performing operations using the REST API is explained with the help of an example.

Perform the following steps to open a work item by using REST API:

    Procedure
  1. Open a work item by invoking a REST API call on the work presentation service.
    Invoke a PUT method on REST API /Workpresentationitem by passing the work id, version, payload, and the WMstateOpen state
    { 
     "id": "string",
      "version": "string",
      "header": {
        "name": "string",
        "description": "string",
        "itemContext": {
          "activityId": "string",
          "activityName": "string",
          "appInstance": "string",
          "appName": "string",
          "appVersion": 0,
          "appId": "string",
          "appInstanceDescription": "string",
          "processName": "string",
          "caseRef": "string"
        },
        "workType": {
          "uid": "string",
          "version": "string"
        }
      },
      "state": {
        "stringKey": "WMstateOpen",
        "description": "string"
      },
      "body": {
        "inputs": [
          {
            "name": "string",
            "simple": [
              {
               
              }
            ],
            "structured": [
              {
               
              }
            ]
          }
        ],
        "outputs": [
          {
            "name": "string",
            "simple": [
              {
               
              }
            ],
            "structured": [
              {
               
              }
            ]
          }
        ],
        "inouts": [
          {
            "name": "string",
            "simple": [
              {
               
              }
            ],
            "structured": [
              {
               
              }
            ]
          }
        ]
      },
      "presentation": {
        "channelId": "string",
        "channelType": "string",
        "formIdentifier": "string",
        "pageflow": {
          "moduleName": "string",
          "processName": "string",
          "version": "string"
        },
        "worktypeId": "string",
        "worktypeVersion": "string"
      }
    }
    The response of the above calls returns the updated payload and the form details associated with the work item task. If the work item is associated with a pageflow, pageflow details are returned as part of the open work item response.
  2. Based on the pageflow details returned as part of the work item response, the client application invokes Pageflow POST REST API instance call to start the pageflow. For details, click API Explorer > Process Management Service.
    /Instances creates an instance in the specified pageflow process.
    Work item data returned from the work presentation call is passed in as data to pageflow call. The module below is passed as part of the payload to the REST call that returned in the open work item call.
    {
      "moduleName": "string",
      "processName": "string",
      "moduleVersion": "string",
      "data": "string"
    }
    Response of the Pageflow call returns the pageflow details and the activity information paused at the Activity pageflow. The response returns the state of the pageflow.
    {
      "instanceId": "string",
      "processId": "string",
      "moduleName": "string",
      "moduleVersion": "string",
      "processName": "string",
      "processLabel": "string",
      "state": {
        "state": "STARTING",
        "failedMessage": {
          "msgName": "START",
          "exceptionMsg": "string",
          "exceptionStack": "string",
          "msgData": "string",
          "activityData": "string"
        }
      },
      "activityInfo": {
        "activityId": "string",
        "activityName": "string",
        "activityProcessPackageId": "string",
        "activityProcessModuleName": "string",
        "activityProcessModuleVersion": "string",
        "activityPageflowName": "string",
        "activityData": "string"
      }
    }
  3. To retrieve the form details of the activity, the client application invokes the work presentation GET work item pageflow call. For details, click API Explorer > Presentation Management Service.
    /WorkItemPageFlow is the Pageflow associated with the work item.
    The response of this REST call returns the form details as a form identifier.
    {
      "moduleName": "string",
      "processName": "string",
      "moduleVersion": "string",
      "pageflowActivities": [
        {
          "activityName": "string",
          "activityId": "string",
          "formIdentifier": "string"
        }
      ]
    }
    The client application uses the form identifier and renders the form using forms runtime.
  4. The user interacts with the forms and enters the data in the form and when the form is closed or completed, Pageflow PUT call is called to progress the pageflow. The data returned from the form is passed in as a payload to Pageflow call.
    /Instances updates a specified Process Instance.
    {
    "instanceId": "string",
      "processId": "string",
      "moduleName": "string",
      "moduleVersion": "string",
      "processName": "string",
      "processLabel": "string",
      "state": {
        "state": "STARTING",
        "failedMessage": {
          "msgName": "START",
          "exceptionMsg": "string",
          "exceptionStack": "string",
          "msgData": "string",
          "activityData": "string"
        }
      },
      "activityInfo": {
        "activityId": "string",
        "activityName": "string",
        "activityProcessPackageId": "string",
        "activityProcessModuleName": "string",
        "activityProcessModuleVersion": "string",
        "activityPageflowName": "string",
        "activityData": "string"
      }
    }
  5. After the pageflow execution is complete, this information of pageflow state can be found in the state attribute of the pageflow response. Work presentation PUT call is invoked to complete the work item which passes the payload that is received from the form. It also passes the appropriate work item state depending on if the form is closed or submitted. When closing the work item, WMstateClose is passed and when submitting the form, WMstateCompleted is passed.
    /Workpresentationitem updates the specified work item
    { 
     "id": "string",
      "version": "string",
      "header": {
        "name": "string",
        "description": "string",
        "itemContext": {
          "activityId": "string",
          "activityName": "string",
          "appInstance": "string",
          "appName": "string",
          "appVersion": 0,
          "appId": "string",
          "appInstanceDescription": "string",
          "processName": "string",
          "caseRef": "string"
        },
        "workType": {
          "uid": "string",
          "version": "string"
        }
      },
      "state": {
        "stringKey": "WMstateCompleted",
        "description": "string"
      },
      "body": {
        "inputs": [
          {
            "name": "string",
            "simple": [
              {
               
              }
            ],
            "structured": [
              {
               
              }
            ]
          }
        ],
        "outputs": [
          {
            "name": "string",
            "simple": [
              {
               
              }
            ],
            "structured": [
              {
               
              }
            ]
          }
        ],
        "inouts": [
          {
            "name": "string",
            "simple": [
              {
               
              }
            ],
            "structured": [
              {
               
              }
            ]
          }
        ]
      },
      "presentation": {
        "channelId": "string",
        "channelType": "string",
        "formIdentifier": "string",
        "pageflow": {
          "moduleName": "string",
          "processName": "string",
          "version": "string"
        },
        "worktypeId": "string",
        "worktypeVersion": "string"
      }
    }