Setting Up Workflows

Overview

Every service integrated with egov-workflow-v2 service needs to first define the workflow configuration which describes the states in the workflow, the action that can be taken on these states, who all can perform those actions, SLA, etc. This configuration is created using APIs and is stored in DB. The configuration can be created either at the state-level or tenant-level based on the requirements.

Pre-requisites

Before you proceed with the configuration, make sure the following pre-requisites are met:

  • egov-workflow-v2 service is up and running

  • Role Action mapping is added for the BusinessService API’s

Key Functionalities

  • Create and modify the workflow configuration.

  • Configure the state level as well the BusinessService-level SLA.

  • Control access to workflow actions from configuration.

  • Validate if the flow defined in configuration is complete during creation.

Deployment Details

  1. Deploy latest version of egov-workflow-v2 service.

  2. Add role action mapping for BusinessService API’s (preferably add create and update only for SUPERUSER. Search can be added for a CITIZEN and required employee roles like TL_CEMP, etc.).

  3. Overwrite the egov.wf.statelevel flag (true for state-level and false for tenant-level).

  4. Add businessService persister yaml path in persister configuration.

Confuiguration Details

1. Create the businessService JSON based on the product requirement. Following is a sample json of a simple 2-step workflow where an application can be applied by a citizen or counter employee, and then can be either rejected or approved by the approver.

{
      "tenantId": "pb",
      "businessService": "PGR",
      "business": "pgr-services",
      "businessServiceSla": 432000000,
      "states": [
        {
          "sla": null,
          "state": null,
          "applicationStatus": null,
          "docUploadRequired": false,
          "isStartState": true,
          "isTerminateState": false,
          "isStateUpdatable": true,
          "actions": [
            {
              "action": "APPLY",
              "nextState": "PENDINGFORASSIGNMENT",
              "roles": [
                "CITIZEN",
                "COUNTER_EMPLOYEE"
              ]
            }
          ]
        },
        {
          "sla": null,
          "state": "APPLIED",
          "applicationStatus": "APPLIED",
          "docUploadRequired": false,
          "isStartState": false,
          "isTerminateState": false,
          "isStateUpdatable": false,
          "actions": [
            {
              "action": "APPROVE",
              "nextState": "APPROVED",
              "roles": [
                "APPROVER"
              ]
            },
            {
              "action": "REJECT",
              "nextState": "REJECTED",
              "roles": [
                "APPROVER"
              ]
            }
          ]
        },
        {
          "sla": null,
          "state": "REJECTED",
          "applicationStatus": "REJECTED",
          "isStateUpdatable": false,
          "docUploadRequired": false,
          "isStartState": false,
          "isTerminateState": true
        },
        {
          "sla": null,
          "state": "APPROVED",
          "applicationStatus": "APPROVED",
          "isStateUpdatable": false,
          "docUploadRequired": false,
          "isStartState": false,
          "isTerminateState": true
        }
      ]
    }

2. Once the businessService json is created, add it in request body of _create API of the workflow, and call the API to create the workflow.

3. To update the workflow, search the workflow object using _search API, and then make changes in the businessService object and then call _update using the modified search result. (States cannot be removed using _update API as it will leave the applications in that state in an invalid state. In such cases, first all the applications in that state should be moved forward or backward, and then the state should be disabled through DB directly).

Integration

Integration Scope

The workflow configuration can be used by any module which performs a sequence of operations on an application/entity. It can be used to simulate and track processes in organisations to make it more efficient, and increase the accountability.

Integration Benefits

Integrating with the workflow service provides a way to have a dynamic workflow configuration which can be easily modified according to the changing requirements. The modules do not have to deal with any validations regarding the workflow such as authorisation of the user to take an action, if documents are required to be uploaded at certain stage, etc., as they will be automatically handled by egov-workflow-v2 service based on the configuration defined. It automatically keeps updating the SLA for all applications, which provides a way to track the time taken by an application to get processed.

Steps to Integration

  1. To integrate, the host of egov-workflow-v2 should be overwritten in the helm chart.

  2. /egov-workflow-v2/egov-wf/businessservice/_search should be added as the endpoint for searching the workflow configuration. (Other endpoints are not required once the workflow configuration is created).

  3. The configuration can be fetched by calling _search API.

Reference Docs

API List

Note: All APIs are in the same postman collection. Hence, the same link has been added in each row.

Last updated

All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.