Reltio UI Inbox Filter Customization
Custom Variables Filter in Reltio Inbox – Custom Jar
Overview
In Reltio DCR, the tasks associated with a given DCR have variables (attribute name ‘taskVariables’) in each of the user tasks. This document describes how to create a custom jar to be able to add the DCR attributes to the tasksVariables for a given DCR. This can help refine the DCR search filter criteria for the clients.
Out of the box task variables for DCR are:
-
dcrType
-
decision
-
startEvent1
|
Note: |
To see these task variables in the give dcr task, the GET Tasks API should include the option “showTaskVariables=true” |
In addition to the above, if we want to see some of the custom attributes from the DCR, such as the externalInfo attributes then we need to provide a custom jar to Reltio. This custom jar can have custom code to include attributes that we would like to add to the ‘taskVariables’ list. Reltio can review and approve the custom code, the custom Jar can then be made available by Reltio in a S3 location. This Jar file can now be deployed in a given Reltio tenant. Once that is set up, the given BPMN file in the given Reltio Tenant could be modified to call the custom listener class.
Build and Deploy a Custom Jar
Steps to Build and Deploy a Custom Jar
To be able to achieve the above, you can need to create a custom listener class in a local package with your desired changes. Once the custom jar is available, it can be deployed in a given tenant. Below are the steps to create a custom jar
-
Get the Reltio Workflow Project from https://bitbucket.org/reltio-ondemand/workflow/src/master by copying it from the Reltio Repository to a folder on your workstation (git clone https://bitbucket.org/reltio-ondemand/workflow.git).
-
Import the project into your IDE (Eclipse, intellij, etc.).
-
Follow the instructions in the project’s README.md file and update the project’s pom file as well as the maven repository’s configuration file (settings.xml) located at %USER_HOME%/.m2.
-
Create a new package in the workflow-custom project, such as iqvia.workflow.activiti.service.
-
Add a new class, for example, java in the above package, which is a copy of the Reltio provided class com.reltio.workflow.activiti.service.DCRTypeTaskListener.
-
This is the class where the custom code needs to be added, similar to the following:
-
Add a method to have a list of variables that you want to be added to the taskVariables for a given DCR Task - Here you can add whatever attributes you would like to see in the list of task variables.
Copyprivate List<String> getVariableNameList() {
// Get the list of variables
// Add the dcr.externalInfo attributes that you want to see in the taskVariables
return Arrays.asList("User", "DCRStatus", "stage");
} -
This below piece of code should be added to the implemented method in the custom listener class– notify(Task task). In this code essentially a Relito API call is made to get the given DCR’s externalInfo and then we iterate through the externalInfo attributes and match with our custom list of attributes. All that matches is written to the DCR's task.taskVariables.
Copy/*
* IQVIA POC code to add the task variables, the attributes from the DCR's externalInfo
* Similarly, it can be extended for other DCR attributes to be added to the task variables
*/
String chanegRequesturi = null;
// Make sure that we get the changeRequest URI and not the other URIs(entity or relations)
for(String objectUri: task.getObjectUris()) {
if(objectUri.contains("changeRequests"))
chanegRequesturi = objectUri;
}
final String url = Utility.generateTenantUrl(task.getEnvironmentUrl(), task.getTenantId()) + "/" + chanegRequesturi + "/_externalInfo";
if(headerMap.size() == 0) {
headerMap.put("Content-Type", "application/json");
headerMap.put("EnvironmentURL", task.getEnvironmentUrl());
}
try {
String externalInfoResponse = reltioApi.invokeApi(task.getAccessToken(), url, "GET", null);
if(null != externalInfoResponse) {
if(externalInfoResponse.length() > 0) {
JsonNode jNode = objectMapper.readTree(externalInfoResponse);
List<String> varList = getVariableNameList();
List<String> externalInfoKeys = new ArrayList<String>();
Iterator<String> iterator = jNode.fieldNames();
iterator.forEachRemaining(e -> externalInfoKeys.add(e));
varList.forEach(v -> {
if(externalInfoKeys.indexOf(v) > 0) {
taskService.setVariable(task.getId(), v, jNode.get(v).asText());
}
});
}
}
} catch (ReltioException | IOException e) {
logger.error("Failed to get types: {}", url, e);
} -
After making sure that there are no compilation errors, if already not done, make the following addition to the pom.xml file to exclude other Reltio package in the jar file:
Copy<!-- Added for exclusions -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<includes>
</includes>
<excludes>
<exclude>**/com/reltio/workflow/**</exclude>
</excludes>
</configuration>
</plugin -
Run the Maven clean install build command to build the jar file. If the build is successful, you should see the following jar files in the target folder of your project.
-
Create a Reltio Task Ticket requesting to get the custom jar deployed on the given tenant. Attach the two highlighted jar files within the ticket.
-
Reltio can review the source code and if everything is fine and acceptable then they can deploy the jar in the given Reltio Tenant. Note – this jar is located at a custom IQVIA location in the Reltio’s S3 bucket.
-
Next the BPMN file should be modified to add the custom listener. This custom listener should be added to all the user tasks for which we want these custom variables to be searched on, in Reltio UI Inbox. Here is the screenshot as to how to add the custom listener class to a given user task(examle, Internal External).
Custom Class in this POC: com.iqvia.workflow.activiti.service.DCRTypeTaskListenerCustomIqvia
-
Once the BPMN file is successfully redeployed, a test DCR can be created to verify that the DCR task contains the variables in the list. See below, the highlighted variables are the ones that we added in our custom listener class.
-
Now we can verify in Reltio UI Inbox, by searching on these task variables. Notice in the screenshot that now the custom variables are showing up in the filter field ‘Filter Type’ –
Here is a complete screenshot displaying how we can search on DCRs based on the DCR’s externalInfo attributes that we added to the task variables via the custom Jar implementation.
-
Java Project
The custom code and changes could be run in a Reltio Workflow debug environment setup on the local machine. Follow the below link to setup the local debug environment for Reltio Workflow –https://documentation.reltio.com/workflow/setupwfadapter.html?hl=local%2Cdebug.