All pages
Powered by GitBook
1 of 5

Loading...

Loading...

Loading...

Loading...

Loading...

Manage Master Data

Overview

The Manage Master Data screen allows users to manage master data. Navigate to the Manage Master Data from the home screen card.

Manage Master Data - User Role

  • MDMS_ADMIN

  • For the provided role, it is necessary to include all role action mappings associated with master data in MDMS.

   {
     "name": "MDMS_ADMIN",
     "code": "MDMS_ADMIN",
     "tenantId": "pg"
  }

View Master Data

Flow for viewing master data

Overview

From the search master data screen users can click on any of the rows in the results table, this will redirect the UI to the View master data screen.

Rendering View Master Data Screen Logic

  • Before loading the View screen, we fetch the schema and the data using the schema code and unique Identifier respectively. Curls for search schema and search data can be referred from the Add Master Data page.

  • Schema response is used to render the form, similar to add form, and the data response is used to prefill the values in the form. The only difference here is that all the fields are disabled, unlike the add screen.

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

In the View screen, we have an action button with two options
  1. Edit Master Data

  2. Disable Master Data

  • The above actions are covered in the Update Master Data page.

  • Add Master Data

    Flow for adding master data from UI

    Overview

    Add Master Data Flow

    • An action button is available on the search master data screen to add master data.

    • Clicking on the action button redirects users to the add master data screen.

    • The Add Master Data screen renders a form through which the user can enter master data.

    • Once the form is submitted, the validations are run as specified in the schema. If the validations are passed, the Create API is called and the respective toast message is shown as relevant to the response received from the Create API.

    Role Action Mapping To Access Create API

    • As of now, role actions have to be defined for every schema. Let us take an example of a schema code "Trade.Details"

    • The Create API URL for the above schema will look like this "/mdms-v2/v2/_create/Trade.Details"

    • Hence for this URL, the role action mapping has to be added to the MDMS_ADMIN role.

    • Similarly, for other masters, add role action mapping to the same role "MDMS_ADMIN".

    Create Master Data API

    Refer to the curl below:

    Sample request body:

    curl 'http://localhost:3000/mdms-v2/v2/_create/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-add-v2?moduleName=Trade&masterName=Validations' \
      -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":{"tenantId":"pb","schemaCode":"Trade.Validations","uniqueIdentifier":null,"data":{"name":"sfd","dropdownField":"90-100"},"isActive":true},"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":"1694161641687|en_IN","plainAccessRequest":{}}}' \
      --compressed
    {
        "Mdms": {
            "tenantId": "pb",
            "schemaCode": "Trade.Validations",
            "uniqueIdentifier": null,
            "data": {
                "name": "sfd",
                "dropdownField": "90-100"
            },
            "isActive": true
        },
        "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": "1694161641687|en_IN",
            "plainAccessRequest": {}
        }
    }

    Search Master Data

    How to search master data

    Overview

    Search Master Data Flow

    • Users can click on the specific master name from the dropdown on the Manage Master Data screen to select the master data.

    • Users are redirected to the Search Master Data screen (of the selected master) screen as soon as a master is selected.

    • By default, the data present in that master is shown in the Results table.

    • Users can search master data using the following input parameters -

    Note -> Search with field and value is considered as one parameter. Make sure to enter both in order to search master data.

    • 'isActive' is a Boolean parameter which results in either active or inactive master data. All master data contain this field by default.

    • For the time being, master data search is allowed with string fields and the isActive flag.

    • Search results are filtered by string type and isActive before getting rendered in the table.

    Search Schemas API

    The master and module dropdowns on the manage master screen are populated on the basis of the responses from the schema search. Refer to the below curl for details:

    Use the below parameters to search for the schemas -

    1. tenantId

    2. limit

    3. offset

    4. codes -> list of schema codes

    Search Master Data For Specific Schema API

    Users are redirected to the search master data screen once a specific master is selected from the manage master data screen.

    Refer to the below API curl to search for the master data -

    The parameters here are used to search for the master data. Refer to the request body object below.

    The "data" object holds the field-value pairs used to search for master data within a specific master. The "uniqueIdentifier" is a backend-generated ID for each master data.

  • Field

  • Value

  • is Active

  • curl --location 'http://localhost:8094/mdms-v2/schema/v1/_search' \
    --header 'Content-Type: application/json' \
    --data '{
        "RequestInfo": {
            "apiId": "asset-services",
            "ver": null,
            "ts": null,
            "action": null,
            "did": null,
            "key": null,
            "msgId": "search with from and to values",
            "authToken": "dfcca143-b5a6-4726-b5cd-c2c949cb0f2b",
            "correlationId": null,
            "userInfo": {
                "id": "1",
                "userName": null,
                "name": null,
                "type": null,
                "mobileNumber": null,
                "emailId": null,
                "roles": null
            }
        },
        "SchemaDefCriteria": {
            "tenantId": "pb",
            "codes": [
                "Trade.Fields"
            ],
            "limit":50
        }
    }'
    curl --location 'http://localhost:8094/mdms-v2/v2/_create/common-masters.Sample' \
    --header 'Content-Type: application/json' \
    --data '{
      "RequestInfo": {
        "apiId": "asset-services",
        "ver": null,
        "ts": null,
        "action": null,
        "did": null,
        "key": null,
        "msgId": "search with from and to values",
        "authToken": "dfcca143-b5a6-4726-b5cd-c2c949cb0f2b",
        "correlationId": null,
        "userInfo": {
          "id": "1",
          "userName": null,
          "name": null,
          "type": null,
          "mobileNumber": null,
          "emailId": null,
          "roles": null
        }
      },
      "Mdms": {
        "tenantId": "pg",
        "schemaCode": "common-masters.Sample",
        "uniqueIdentifier": "aa4d8d08-658b-45c1-af4d-d57428fa5e52",
        "data": {
                    "id": "sdfljksd",
                    "code": "testtcode",
                    "name": "nameeee",
                    "description": "descccc"
                },
        "isActive": true
      }
    }'
    
     {
        "tenantId": "pg",
        "schemaCode": "common-masters.Sample",
        "uniqueIdentifier": "aa4d8d08-658b-45c1-af4d-d57428fa5e52",
        "data": {
                    "id": "sdfljksd",
                    "code": "testtcode",
                    "name": "nameeee",
                    "description": "descccc"
                },
        "isActive": true
      }
    

    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.

    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.

    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).

    Sample request body for update:

    Pls refer to the end of this page for updated API details
  • 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.

  • 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
    {
        "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": {}
        }
    }