> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/platform/build/core-services/workflow/migration-to-workflow-2.0.md). Agents can also search and read this documentation through its [MCP server](https://docs.digit.org/~gitbook/mcp).

# Migration To Workflow 2.0

Deploy workflow 2.0 in an environment where workflow is already running

## Overview

In workflow 2.0 assignee is changed from an object to a list of objects.

## Deployment Details

To accommodate this change a new table named 'eg\_wf\_assignee\_v2' is added that maps the processInstaceIds to assignee UUIDs. To deploy workflow 2.0 in an environment where workflow is already running assignee column needs to be migrated to the eg\_wf\_assignee\_v2 table.

The following query does this migration:

{% code lineNumbers="true" %}

```
INSERT INTO eg_wf_assignee_v2(processinstanceid, tenantid, assignee, createdBy, lastModifiedBy, createdTime, lastModifiedTime) SELECT id, tenantid,
         assignee, createdBy, lastModifiedBy ,createdTime,lastModifiedTime FROM eg_wf_processinstance_v2 WHERE assignee IS NOT NULL;
```

{% endcode %}

## Configuration Details

### Persister Configuration

Persister config for egov-workflow-v2 is updated. Insert query for the table eg\_wf\_assignee\_v2 is added in egov-workflow-v2-persister.yml.

The latest updated config can be referred to from the below link:

{% embed url="<https://github.com/egovernments/configs/blob/master/egov-persister/egov-workflow-v2-persister.yml>" %}

### Searcher Configuration

The employee inbox has an added column to display the locality of the applications. This mapping of the application number to locality is fetched by calling the searcher API for the respective module. If a new module is integrated with workflow its searcher config should be added in the locality searcher yaml with module code as a name in the definition. All the search URLs and role action mapping details must be added to the MDMS.

The format of the URL is given below:

{% code lineNumbers="true" %}

```
        /egov-searcher/locality/{MODULENAME}/_get
```

{% endcode %}

Sample request for TL:

{% code lineNumbers="true" %}

```
  curl -X POST \
        https://egov-micro-dev.egovernments.org/egov-searcher/locality/TL/_get \
        -H 'Content-Type: application/json' \
        -H 'Postman-Token: 1c2adbb9-004f-42ce-8aab-a29a2b0df7a7' \
        -H 'cache-control: no-cache' \
        -d '{
        "RequestInfo": {
            "apiId": "Rainmaker",
            "ver": ".01",
            "ts": 0,
            "action": "_create",
            "did": "1",
            "key": "",
            "msgId": "20170310130900|en_IN",
            "authToken": "5cb9019c-f690-4c88-850d-d15cbc2c6e54",
            "correlationId": "a2e4642e-8cb5-483b-8ea2-827cbe822c5f"
        },
        "searchCriteria": {
            "referenceNumber":[ "PB-TL-2019-04-24-001768","PB-TL-2019-04-22-001764"]
        }Migration
        }' 
```

{% endcode %}

The searcher yaml can be referred from the below link:

{% embed url="<https://github.com/egovernments/configs/blob/master/egov-searcher/localitySearcher.yml>" %}

### Business Service Configuration <a href="#businessservice" id="businessservice"></a>

For sending back the application to citizens, the action with the key 'SENDBACKTOCITIZEN' must be added. The exact key should be used. The resultant state of the action should be a new state. If pointing to an existing state the action in that state will be visible to the CITIZEN even when the application reaches the state without Send Back as the workflow is role-based.

To update the businessService for Send Back feature, add the following state and action in the search response at required places and add call businessService update API. This assigns the UUID to the new state and action and creates the required references. The Resubmit action is added as optional action for counter employees to take action on behalf of the citizen.

State json:

{% code lineNumbers="true" %}

```
{
              "sla": null,
              "state": "CITIZENACTIONREQUIRED",
              "applicationStatus": "CITIZENACTIONREQUIRED",
              "docUploadRequired": false,
              "isStartState": false,
              "isTerminateState": false,
              "isStateUpdatable": true,
              "actions": [
                  {
                      "action": "FORWARD",
                      "nextState": "FIELDINSPECTION",
                      "roles": [
                          "CITIZEN"
                      ]
                  },
                  {
                      "action": "RESUBMIT",
                      "nextState": "FIELDINSPECTION",
                      "roles": [
                          "TL_CEMP"
                      ]
                  }
              ]
}
```

{% endcode %}

Action json:

{% code lineNumbers="true" %}

```
{
          "action": "SENDBACKTOCITIZEN",
          "nextState": "CITIZENACTIONREQUIRED",
          "roles": [
              "TL_FIELD_INSPECTOR"
          ]
}
```

{% endcode %}

### UI Configuration

Each item in the above dropdown is displayed by adding an object in the link below -

{% embed url="<https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ACCESSCONTROL-ACTIONS-TEST/actions-test.json>" %}

<div align="left"><figure><img src="https://content.gitbook.com/content/051YseixNq69PlJkCdKt/blobs/PUPDZcj80ks2jrg7BmSb/image.png" alt=""><figcaption></figcaption></figure></div>

For example:

{

"id": 1928,

"name": "rainmaker-common-tradelicence",

"url": "quickAction",

"displayName": "Search TL",

"orderNumber": 2,

"parentModule": "",

"enabled": true,

"serviceCode": "",

"code": "",

"path": "",

"navigationURL": "tradelicence/search",

"leftIcon": "places:business-center",

"rightIcon": "",

"queryParams": ""

}

* **id , url, displayName, navigationURL**
  * Mandatory properties.
* The value of the URL property should be “**quickAction**” as shown above.

Accordingly, add the role-actions:

[<img src="https://github.com/fluidicon.png" alt="" data-size="line">egov-mdms-data/roleactions.json at master · egovernments/egov-mdms-data](https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ACCESSCONTROL-ROLEACTIONS/roleactions.json)

{

"rolecode": "TL\_CEMP",

"actionid": 1928,

"actioncode": "",

"tenantId": "pb"

}

### **SLA Configuration**

<figure><img src="https://content.gitbook.com/content/051YseixNq69PlJkCdKt/blobs/1OFueO9D8bHVxtgDwCQD/image.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/051YseixNq69PlJkCdKt/blobs/vvjSxuyHPz4KgBKFQgJu/image.png" alt=""><figcaption></figcaption></figure>

SLA slots and the background colour of the SLA days remaining on the Inbox page are defined in the MDMS configuration as shown above.

For example: If the maximum SLA is 30 then, it has 3 slots

1. 30 - 30\*(1/3) => 20 - 30: will have green colour defined
2. 0 - 20: will have yellow colour defined
3. <0: will have red colour defined

The colours are also configured in the MDMS.

## Integration Details

* For API */egov-workflow-v2/egov-wf/process/\_transition*:\
  The field assignee of type User in ProcessInstance object is changed to a list of 'User' called assignees.\
  User assignee --> List\<User> assignees
* For Citizen Sendback:\
  When the action SENDBACKTOCITIZEN is called on the entity the module has to enrich the assignees with the UUIDs of the owners and creator of the entity.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/platform/build/core-services/workflow/migration-to-workflow-2.0.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
