Update Master Data

Flow for updating master data from UI

The users have two options on the View Master Data screen -

  1. Disable/Enable Master Data

  2. Edit Master Data

Disable/Enable Master Data

  • This option is dynamic, if the master data is currently disabled(computed through the "isActive" flag present in every master data) Enable option is shown and vice-versa.

  • Update Master data API is called with the updated value of "isActive" flag and a respective toast message is shown to the user

  • As soon as the API responds, this option is updated according to the new value of "isActive" flag.

  • Pls refer to the end of this page for updated API details

Edit Master Data

  • When the user clicks on this option, the screen redirects to the Edit master data screen.

  • This screen is similar to the add master data screen, but all the fields are pre-populated with previous data.

  • Users can make changes to the master data.

  • Once the user clicks on the Submit button, validations are run in UI (specified in schema). If the validations are passed update master data API is called and a toast message is shown. After 5 seconds the user is automatically redirected to the view screen, where the updated data is reflected.

  • If the validations fail, the respective error message is shown below the target field for which validations failed.

  • The same role action mapping rules apply here as mentioned in the Add Master data page.

Update Master Data API

Refer to the curl below to update the master data API. It is very similar to the Create Master Data. (Notice the URL is unique to the schema for which the master data belongs, similar to add).

curl 'http://localhost:3000/mdms-v2/v2/_update/Trade.Validations' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Origin: http://localhost:3000' \
  -H 'Referer: http://localhost:3000/workbench-ui/employee/workbench/mdms-edit?moduleName=Trade&masterName=Validations&uniqueIdentifier=sfd' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \
  -H 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  --data-raw '{"Mdms":{"id":"661b4560-a0ec-4930-a8c2-c84d643b361f","tenantId":"pb","schemaCode":"Trade.Validations","uniqueIdentifier":"sfd","data":{"name":"sfd","dropdownField":"70-90"},"isActive":true,"auditDetails":{"createdBy":"aeb85b37-c996-4218-bdca-1b00cc268f2f","lastModifiedBy":"aeb85b37-c996-4218-bdca-1b00cc268f2f","createdTime":1694161642579,"lastModifiedTime":1694161642579}},"RequestInfo":{"apiId":"Rainmaker","authToken":"5bbfa93c-adc2-42b2-992e-a708a83cb2cf","userInfo":{"id":80234,"uuid":"aeb85b37-c996-4218-bdca-1b00cc268f2f","userName":"WBQA","name":"LOC","mobileNumber":"9999991942","emailId":null,"locale":null,"type":"EMPLOYEE","roles":[{"name":"MDMS ADMIN","code":"MDMS_ADMIN","tenantId":"pb"},{"name":"Super User","code":"SUPERUSER","tenantId":"pb"},{"name":"Localisation admin","code":"LOC_ADMIN","tenantId":"pb"},{"name":"Employee","code":"EMPLOYEE","tenantId":"pb"}],"active":true,"tenantId":"pb","permanentCity":null},"msgId":"1694163335209|en_IN","plainAccessRequest":{}}}' \
  --compressed

Sample request body for update:

{
    "Mdms": {
        "id": "661b4560-a0ec-4930-a8c2-c84d643b361f",
        "tenantId": "pb",
        "schemaCode": "Trade.Validations",
        "uniqueIdentifier": "sfd",
        "data": {
            "name": "sfd",
            "dropdownField": "70-90"
        },
        "isActive": true,
        "auditDetails": {
            "createdBy": "aeb85b37-c996-4218-bdca-1b00cc268f2f",
            "lastModifiedBy": "aeb85b37-c996-4218-bdca-1b00cc268f2f",
            "createdTime": 1694161642579,
            "lastModifiedTime": 1694161642579
        }
    },
    "RequestInfo": {
        "apiId": "Rainmaker",
        "authToken": "5bbfa93c-adc2-42b2-992e-a708a83cb2cf",
        "userInfo": {
            "id": 80234,
            "uuid": "aeb85b37-c996-4218-bdca-1b00cc268f2f",
            "userName": "WBQA",
            "name": "LOC",
            "mobileNumber": "9999991942",
            "emailId": null,
            "locale": null,
            "type": "EMPLOYEE",
            "roles": [
                {
                    "name": "MDMS ADMIN",
                    "code": "MDMS_ADMIN",
                    "tenantId": "pb"
                },
                {
                    "name": "Super User",
                    "code": "SUPERUSER",
                    "tenantId": "pb"
                },
                {
                    "name": "Localisation admin",
                    "code": "LOC_ADMIN",
                    "tenantId": "pb"
                },
                {
                    "name": "Employee",
                    "code": "EMPLOYEE",
                    "tenantId": "pb"
                }
            ],
            "active": true,
            "tenantId": "pb",
            "permanentCity": null
        },
        "msgId": "1694163335209|en_IN",
        "plainAccessRequest": {}
    }
}

Last updated

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