Create a workflow to change asset responsibilities

In this tutorial, you will learn how to create a workflow that allows users to automatically change their responsibility on an asset.

Prerequisites

  • Eclipse IDE.
  • Flowable Eclipse Designer plugin.
  • Access to a Collibra DGC environment as a user with the Sysadmin global role or a global role that has at least the Workflow Administration global permission.
  • Access to the Collibra Console for troubleshooting.

For more installation details and to get familiar with the Eclipse IDE interface, see Getting Started with workflows.

Example workflow

To get started, use the example Change Responsibilities workflow. This workflow changes the responsibility of the current user from a source role to a target role.

The start event form has two string process variables that represent the Universally Unique Identifiers (UUIDs) of the source and target roles. Their default value is 0 and must be configured on the workflow definition page in Collibra Data Governance Center.

The Groovy script task performs the following operations:

  • Collects the required UUID for the userID, sourceRoleID, and targetRole ID.
    UUID userId = userApi.getUserByUsername(startUser).getId();
    UUID sourceRoleUuid = string2Uuid(execution.getVariable("sourceRoleId"));
    UUID targetRoleUuid = string2Uuid(execution.getVariable("targetRoleId"));
  • Assigns the target responsibility to the current user.
    AddResponsibilityRequest targetRequest = AddResponsibilityRequest.builder().resourceId(item.id).resourceType(item.getType()).ownerId(userId).roleId(targetRoleUuid).build();responsibilityApi.addResponsibility(targetRequest);
  • Removes the source responsibility from the current user if it only appears once.
    FindResponsibilitiesRequest findSource = FindResponsibilitiesRequest.builder().resourceIds([item.id]).ownerIds([userId]).roleIds([sourceRoleUuid]).build();
    Responsibility[] responsibilities = responsibilityApi.findResponsibilities(findSource).getResults();
    
    if (responsibilities.length == 1) {
        responsibilityApi.removeResponsibility(responsibilities[0].getId());
    }else {
        loggerApi.info("Multiple responsibilities found");
    }

Deploy the workflow

  1. Sign in to Collibra DGC as a user with the Sysadmin global role or a global role that has at least the Workflow Administration global permission.
  2. In the main menu, click Settings.
  3. In the tab pane, click
    WorkflowsDefinitions.
  4. Click Upload a file and locate the BPMN file.An Activity Queue window displays the upload progress. After you upload the workflow file, it displays in the Workflows Definitions table.

For more details, see the Deploy a workflow section of the Collibra Data Governance Center Administration Guide.

Configure the workflow definition

You must configure the workflow in Collibra Data Governance Center so it is available only on asset pages and only to users who have a specific source role for that asset.

  1. In the main menu, click Settings.
  2. In the tab pane, click
    WorkflowsDefinitions.
  3. Select the Change Responsibilities workflow.
  4. On the workflow definition settings page, configure the following options:
    1. In the Applies To section, click , and select Asset.
    2. In the Variables section, click , and then enter the source role Id and the target role id.
    3. In the Roles section, click Start Workflow, and then select the target role.
  5. Optionally, change the Start Label to something meaningful. This is the workflow button name that displays on the asset pages.
  6. Enable the workflow.

Testing

To test this workflow, log into your Collibra Data Governance Center instance as a user with the source role configured in the workflow.

In this example, Colette is assigned the Reviewer role on the Accuracy asset. Because Reviewer is the role configured in the example workflow, the Change Responsibilities workflow button displays in the Resource toolbar.

After Colette clicks the Change Responsibilities workflow button, her role changes to Business Steward, which is configured as the target role, and the workflow is no longer available to her.

Troubleshooting

In case of errors, you can view the logs for more information about the error:

  1. Open Collibra Console.Collibra Console opens with the Infrastructure page.
  2. Click the name of the environment you deployed the workflow in to display its details.
  3. Select Data Governance Center.
  4. Select Logs → dgc.log.

Look for errors related to Flowable, Java, or Groovy.

Additional resources

  • Read the Getting started with workflows Collibra DGC Administration Guide section.
  • Read the Using workflows Collibra DGC User Guide section.
  • Consult the java documentation: https://<your_dgc_environment_url>/docs/javav2/index.html.