Skip to main content

BPM with Camunda Workflows

Below are the various topics/details are documented in this confluence page which provide more technical details on developing the approval process workflows using Camunda BPM tool to approve the customer and contact create and update requests on Azure cloud platform.

1. Environment Setup

Download camunda-modeler-4.12.0-win-x64 and extract it. This will be used to develop the Camunda workflow. Once the workflow is developed, it needs to deployed to Spring boot based runtime environment which run on built in Tomcat server.

Below is the project base which provides the runtime environment based on spring boot and runs on Tomact server. Download the below project to develop/enhance the CMD customer approval workflow.

Maersk-Global/smds-cmd-workflow-service at develop (github.com)

Below are 3 major components of Camunda environment setup.

Camunda Admin page:

Admin is an application that allows you to configure users and groups via the engine’s Identity Service and authorizations via the engine’s Authorization Service. Below is the URL to access admin console.

http://localhost:8080/camunda/app/admin/.

Camunda cockpit page:

Cockpit is a web based application used for monitoring and operations. It provides access to deployed BPMN processes and DMN decisions, allows searching through running and ended instances and performing operations on them. You could access the Cockpit using the below URL:

http://localhost:8080/camunda/app/cockpit/default/#/dashboard

Camunda modeler:

Camunda Modeler is a desktop application that is used for modeling BPMN. It allows you to model files directly on your local file system.

2. Existing Customer & Contact Workflow functionality

In current system the Customer workflow will get triggered during below create scenarios.

  1. If Customer Address is not Validated then WF will get generate
  2. If user tries to create duplicate Customer then WF will get generate
  3. If Customer belongs to European Country and Tax is not validated as per Vies then WF will get generate.
  4. If user select Customer group type as SCPI Tax Exempted while creating
  5. If Customer is detected as Internal Customer then WF gets generated.

In current system the Customer workflow will get triggered during below update scenarios.

  1. Trading Name Change
  2. If user tries to reactivate the customer i.e status change from Suspend to Active
  3. If user select Customer group type as SCPI Tax Exempted
  4. User Updates Address and if it is not Validated
  5. User Updates Customer details and found duplicates and still proceeds further with duplicate creation
  6. User Changes Existing Tax Number or Adds Tax against EU Country for which VIES tax validation fails

Below are the different types of workflow created based on the scenarios (Create/Update) mentioned above.

  1. Suspend-To-Active
  2. Address-Override
  3. Duplicate-Override
  4. VIES-Validation-Failed
  5. Trading-Name-Change
  6. Tax-Change
  7. Account-Group-Change
  8. Customer-Group-Change (SCPI-Tax-Exempted)
  9. Reactivate
  10. BVD_TRADING_NAME_CHANGE - "Bvd-Trading Name Change"
  11. BVD_ACTIVE_INSOLVENCY_PROCEEDINGS - "Bvd-Active (insolvency proceedings)"
  12. BVD_BANKRUPTCY - "Bvd-Bankruptcy"
  13. BVD_IN_LIQUIDATION - "Bvd-In liquidation"
  14. BVD_DISSOLVED_STATUS - "Bvd-Dissolved"
  15. BVD_DISSOLVED_MERGER_OR_TAKE_OVER - "Bvd-Dissolved (merger or take-over)"
  16. BVD_DISSOLVED_DEMERGER - "Bvd-Dissolved (demerger)"
  17. BVD_DISSOLVED_BANKRUPTCY - "Bvd-Dissolved (bankruptcy)"
  18. BVD_DISSOLVED_LIQUIDATION - "Bvd-Dissolved (liquidation)"
  19. BVD_INACTIVE_NO_PRECISION - "Bvd-Inactive (no precision)"
  20. BVD_STATUS_UNKNOWN - "Bvd-Status unknown"

Below is the existing contact workflow functionality.

This will be triggered when user create new customer along with Contact.

This workflow will keep on checking for Customer record whether it is approved or rejected.

  • If customer record rejected then Contact record deleted.
  • If customer record approved then contact will get activated and it will be published

The below query is used to get the role which will be passed to workflow when triggering from UpsertCustomer service.

  1. To get the respective role based on Country. This MDM_ROLE will be retrieved by upsertCustomer service and passed to AVOS. WITH COUNTRY_CODE_DETAILS AS ( SELECT DISTINCT CNTRY_NM.ROWID_OBJECT COUNTRY_MDM_ID, CNTRY_NM.NAME COUNTRY_NAME, CNTRY_CODE.CODE COUNTRY_CODE FROM C_ALT_CODE CNTRY_CODE, C_GDA_DFND_AREA CNTRY_NM WHERE CNTRY_CODE.GDA_DFND_AREA_ROWID = CNTRY_NM.ROWID_OBJECT AND CNTRY_NM.TYP_TYPE_CD = 'GDA.COUNTRY' AND CNTRY_NM.ACTIVE_FLAG = 'Y' AND CNTRY_CODE.TYP_TYPE_ROWID = ( SELECT ROWID_OBJECT FROM C_TYP_TYPE WHERE CODE = 'ALT_CODE.RKST' ) AND ( CNTRY_CODE.CODE = ? ) ) SELECT COUNTRY_CODE_DETAILS.COUNTRY_CODE, C_ALT_CODE.CODE CLUSTER_CODE, CLUSTER_NAME.NAME CLUSTER_NAME, CONCAT('CMD_', C_ALT_CODE.CODE) MDM_ROLE FROM COUNTRY_CODE_DETAILS INNER JOIN C_GDA_DFND_AREA_REL ON C_GDA_DFND_AREA_REL.GDA_DFND_AREA_CHLD_ROWID = COUNTRY_CODE_DETAILS.COUNTRY_MDM_ID INNER JOIN C_GDA_DFND_AREA CLUSTER_NAME ON C_GDA_DFND_AREA_REL.GDA_DFND_AREA_PRNT_ROWID = CLUSTER_NAME.ROWID_OBJECT INNER JOIN C_GDA_BDA CLUSTER_INFO ON CLUSTER_INFO.GDA_DFND_AREA_ROWID = CLUSTER_NAME.ROWID_OBJECT INNER JOIN C_ALT_CODE ON C_ALT_CODE.GDA_DFND_AREA_ROWID = CLUSTER_NAME.ROWID_OBJECT WHERE C_GDA_DFND_AREA_REL.HUB_STATE_IND = 1 AND CLUSTER_NAME.ACTIVE_FLAG = 'Y' AND CLUSTER_INFO.BDA_TYPE_CD = 'CLUSTER' AND C_ALT_CODE.TYP_TYPE_ROWID = ( SELECT ROWID_OBJECT FROM C_TYP_TYPE WHERE CODE = 'ALT_CODE.BDACODE' )

3. Camunda Workflow design

Below is the process flow diagram for customer approval in case of create or update scenarios.

UpsertCustomer service need to trigger customer workflow in below create scenarios:

  1. If Customer Address is not Validated then “Address-Override” WF needs to be triggered
  2. If user tries to create duplicate Customer then “Duplicate-Override” WF needs to be triggered
  3. If Customer belongs to European Country and Tax is not validated as per Vies then “VIES-Validation-Failed” WF needs to be triggered.
  4. If user select Customer group type as SCPI Tax Exempted while creating then “Customer-Group-Change” WF needs to be triggered
  5. If Customer is detected as Internal Customer then “Account-Group-Change“ WF needs to be triggered.
  6. If customer get created using the BVD source then
    1. If trading name change then “Bvd-Trading Name Change” WF needs to be triggered
    2. If the BVD customer status is ‘Active (insolvency proceedings)’ then “Bvd-Active (insolvency proceedings)” WF needs to be triggered.
    3. If the BVD customer status is ‘Bankruptcy’ then “Bvd-Bankruptcy” WF needs to be triggered
    4. If the BVD customer status is ‘In liquidation’ then “Bvd-In liquidation” WF needs to be triggered
    5. If the BVD customer status is ‘Dissolved’ then “Bvd-Dissolved” WF needs to be triggered
    6. If the BVD customer status is ‘Dissolved (merger or take-over)’ then “Bvd-Dissolved (merger or take-over)” WF needs to be triggered
    7. If the BVD customer status is ‘Dissolved (demerger)’ then “Bvd-Dissolved (demerger)” WF needs to be triggered
    8. If the BVD customer status is ‘Dissolved (bankruptcy)’ then “Bvd-Dissolved (bankruptcy)” WF needs to be triggered
    9. If the BVD customer status is ‘Dissolved (liquidation)’ then “Bvd-Dissolved (liquidation)” WF needs to be triggered
    10. If the BVD customer status is ‘Inactive (no precision)’ then “Bvd-Inactive (no precision)” WF needs to be triggered
    11. If the BVD customer status is ‘Status unknown’ then “Bvd-Status unknown” WF needs to be triggered
  7. Customer along with contact also can be created. In this case based on above condition respective customer workflow will be triggered. During review process user/Datasteward should be able to see the customer and contact details under that customer.

UpsertCustomer service need to trigger customer workflow in below update scenarios:

  1. If customer Trading Name Changed then “Trading Name Change” WF needs to be triggered.
  2. If user tries to reactivate the customer i.e status change from Suspend to Active then “Suspend-To-Active” WF needs to be triggered
  3. If user select Customer group type as SCPI Tax Exempted then “Customer-Group-Change” WF needs to be triggered
  4. User Updates Address and if it is not Validated then “Address-Override” WF needs to be triggered
  5. User Updates Customer details and found duplicates and still proceeds further with duplicate creation then “Duplicate-Override“ WF needs to be triggered
  6. User Changes Existing Tax Number then “Tax-Change“ WF needs to be triggered
  7. If user adds Tax against EU Country for which VIES tax validation fails then “VIES-Validation-Failed“ WF needs to be triggered

Below is the input payload structure needs to be passed from UpsertCustomer service when WF is triggered.

{
"variables":
{
"requestType" : {"value":"Create","type":"string"},
"requesterId" : {"[value":"seenu.rvce@gmail.com](mailto:value%22:%22krvarma08@gmail.com)","type":"string"},
"customerCode" : {"value":"IN02738845","type":"string"},
"contactCode" : {"value":"IN04567832","type":"string"},
"ADSRole" : {"value":"CMD\_IBC","type":"string"},
"financeRole" : {"value":"CMDFinance","type":"string"},
"workflowIndicator" : {"value":"DUPLICATE|TRADING\_NAME\_CHANGE","type":"string"},
"sourceSystemName" : {"value":"HSUD","type":"string"},

“autoApproveSystem” : {“value”:”HSUD”, “type”:”string”}
}
}

Based on Country name/code then role needs to be determined in UpsertCustomer and the identified role needs to be passed.

Below table give more details on each field in the input payload.

Field NameDescriptionSample Value
requestTypeThis field indicates the type of request which is either Create or UpdateCreate or Update
requesterIdThis is email id of request submitter which will be used for audit purpose.any valid Maersk email id
customerCodeThis is CMD customer code which will be used for getting complete information about customer.IN02738845
contactCodeThis is CMD contact code which will be used for getting complete information about contact.IN04567832
ADSRoleThis is Area Data Steward role or cluster role to which the task need to be assigned for his/her action. ADS can either approve or reject the request.CMD Super User, CMDAccountGroupManager, CMDConcernCodeManager, CMDCustFacilityManager, CMDDataQualityAssurance, CMDGlobalBusinessAdministrator, CMDHierarchyManager, CMDOnBehalfOfRoleCMDReadOnly, CMDRegulatoryComplianceTeam, CMDSegmentationManager,CMDVipRole, CMDWebBLManager, CMDY_ADMIN, CMD_AEC, CMD_CAD, CMD_CAR, CMD_CIC, CMD_CME, CMD_CWA, CMD_EAF, CMD_EEC, CMD_EME, CMD_ESA, CMD_FRC, CMD_GBC, CMD_GCC, CMD_GEO_CTY_ROLE, CMD_GEO_CTY_ROLE_ReadOnly, CMD_HAE, CMD_IBC, CMD_IDP, CMD_MIC, CMD_NEA ,CMD_NOA, CMD_NWA, CMD_NWC, CMD_OCC, CMD_PKC, CMD_SAC, CMD_SAI, CMD_SAS, CMD_SCA, CMD_SWA, CMD_SWE, CMD_TMS, CMD_VCM, CMD_WME, CMD_WSA
financeRoleThis is the role name required for finance approval.CMDFinance
workflowIndicatorThis indicates what type of workflow it is. What the reason the workflow triggered.SUSPEND_TO_ACTIVEADDRESS_OVERRIDEDUPLICATETRADING_NAME_CHANGEVIES_VALIDATION_FAILEDTAX_CHANGEACC_GROUP_CHANGECUST_GROUP_CHANGEREACTIVATEBVD_TRADING_NAME_CHANGEBVD_ACTIVE_INSOLVENCY_PROCEEDINGSBVD_BANKRUPTCYBVD_IN_LIQUIDATIONBVD_DISSOLVED_STATUSBVD_DISSOLVED_MERGER_OR_TAKE_OVERBVD_DISSOLVED_DEMERGERBVD_DISSOLVED_BANKRUPTCYBVD_DISSOLVED_LIQUIDATIONBVD_INACTIVE_NO_PRECISIONBVD_STATUS_UNKNOWN
sourceSystemNameThis indicate what source system requested to create or update record.PRTL, HSUD, SAP, SFDC
autoApproveSystemThis indicate whether the request should go for approval process or auto approved. This will help for systems for which initially they need auto approve and later they can change to approval process required.Yes, No

When customer create/update request is submitted, the upsertCustomer service need to do below activities:

  1. The records needs to be created in the respective tables and the record state should be in pending
  2. Authenticate the user in AD and get the roles he belongs to.
  3. Determine the ADS role based on country from C_ALT_CODE, C_GDA_DFND_AREA, C_GDA_BDA, C_GDA_DFND_AREA_REL tables.
  4. Derive the workflowIndicator and source system name
  5. Prepare the input payload to trigger the customer workflow
  6. Based on the workflow trigger condition discussed in above section, trigger workflow if condition is met if not no need to trigger workflow.
  7. During the approval process, if user try to update record from UI it should not allow any updates (there should be lock on that customer record).

4. List of APIs required

Sl.NoAPIIn/Out ParametersDetails
1PromoteRecordsIn: CustomerCode ContactCodeOut: result (true/false)When user approve the task from UI, this API will be triggered from Camunda by passing CustomerCode. Based on Customer code promote/update the record status to active in all respective tables. When the record is promoting the new values need to be updated in the base tables. The contact record also will be promoted in case contact is onboarded along with customer.
2Update Valid Through Date to current date in relationship table.In: CustomerCodeOut: result (true/false)When master-duplicate relationship will be removed by user, the reuqest will go for approavl process. Once it is approved the valid through date in relationship table to current date to break it.
3Update customer table CUSTOMER_GROUP_TYPE field to either Internal or External (ZEXC)In: CustomerCode, GroupTypeOut: result (true/false)Once Finance approver approves the request, this API will be used to mark the customer as Internal Customer if Finance approver approves else External customer if Finance approver rejects it.
4Call Publish customer (EMP & MQ) servicesIn: CustomerCode,ContactCodeOut: result (true/false)Call the cloud EMP publish API after records become active to publish customer/contact to EMP topic based on CustomerCode/ContactCode.Once the message is published to EMP on cloud, EMP will replicate cloud message to on-prem. On on-prem platform will convert JSON message to XML and publish to MQ for MQ consumers.
5Delete the customer/Contact recordsIn: CustomerCodeOut: result (true/false)Incase of CREATE scenario: When user reject the task from UI, this API will be triggered from Camunda by passing CustomerCode. Based on Customer code delete the records from the respective core tables for customer and contact.In case of UPDATE scenario: When the record is deleting the new values need to be deleted from CUSTOMER_WF_PROCESS_DETAILS table for customer.
6Create task

Where customizations are required that needs to be handled in backend services.

Below are the roles with access details.

Sl.NoRole NameAccess details
1CMD Super UserAllows all customer edits. CDG Team need this role access.
CMDCustFacilityManager
2CMDDataQualityAssurance
3CMDGlobalBusinessAdministrator
4CMDHierarchyManager
5CMDOnBehalfOfRole
6CMDReadOnly
7CMDRegulatoryComplianceTeam
8CMDSegmentationManager
9CMDVipRole
10CMDWebBLManager
11CMDY_ADMIN
12CMD_AEC
13CMD_CAD
14CMD_CAR
15CMD_CIC
16CMD_CME
17CMD_CWA
18CMD_EAF
19CMD_EEC
20CMD_EME
21CMD_ESA
22CMD_FRC
23CMD_GBC
24CMD_GCC
25CMD_GEO_CTY_ROLE
26CMD_GEO_CTY_ROLE_ReadOnly
27CMD_HAE
28CMD_IBC
29CMD_IDP
30CMD_MIC
31CMD_NEA
32CMD_NOA
33CMD_NWA
34CMD_NWC
35CMD_OCC
36CMD_PKC
37CMD_SAC
38CMD_SAI
39CMD_SAS
40CMD_SCA
41CMD_SWA
42CMD_SWE
43CMD_TMS
44CMD_VCM
45CMD_WME
46CMD_WSA

5. Active Directory Integration

We need to integrate with Active Directory to get the roles and user details and to assign the tasks respectively.

Below points needs to be considered while integrating with AD

  1. User need to login to Customer portal using AD authentication
  2. While triggering the Customer workflow form upsertCustomer API, upsertCustomer need to check user and role details in AD and pass the details in payload.
  3. In the task inbox in CMD portal, make sure the roles against the logged in user needs to be validated and task needs to be displayed accordingly (UI work)
  4. While approving task, first task needs to be claimed against that user and then execute approval action. (this step is not required to be claimed by user because the user already authenticated with AD)

6. Camunda workflow, CMD and UI (CMD Portal) integration

The below diagram shows the interaction between CMD, Camunda WF, CMD Portal, Active directory and BPM Database.

7. Database and Tables for Workflows

8. API Path for Camunda Service:

API Path for Camunda Service is,

/global-mdm/customers/workflows

9. Camunda Service Request Details for CMD UI:

EndpointInput ParamMethod TypeDescription
/global-mdm/customers/workflows/tasks/deploymentMultipartFilePOSTDeploy the BPMN file to Camunda moduler
/global-mdm/customers/workflows/tasks/process/startstartRequestPOSTTrigger the workflow from Ingest customer
/global-mdm/customers/workflows/tasksgroups,owner,taskId,searchApiRequestGETBy default we will fetch list of tasks based on groups.If approver didn’t find the details he will use search and filter the tasks based searchApiRequest
/global-mdm/customers/workflows/tasks/{taskId}/{processId}taskId and processIdGETRetrieve the Existing customer details from ElasticSearch based on customer code and Get Current WorkflowCustomer details from customer_wf_process_detail table
/global-mdm/customers/workflows/tasks/claimtaskId,processId,userApmId,claimstatusPOSTIf any approver wants to review the workflow and approve/reject first he needs to claim the task
/global-mdm/customers/workflows/tasks/commenttaskId and commentPOSTAdd the comments to the task
/global-mdm/customers/workflows/tasks/completetaskId,processId,userApmId,claimstatusPOSTapprove/reject the workflow
/global-mdm/customers/workflows/tasks/process/{processId}processIdGETGet workflow details based on the processId
/global-mdm/customers/workflows/tasks/history/process/{processId}processIdGETGet full workflow history details based on processId

10. Deployment of Workflows

There are ways to deploy the camunda workflow (.bpm) file.

Was this page helpful?