Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Business description

To facilitate the cost approval process, our company decided to auto-fill data, which are use used in the process.

Solution Brief

In that company, each user is related to exactly one department and one cost center. Based on an issue author, we can specify his HR number, department or related cost center, which will be useful in the next steps. We can add another postfunctionpost-function, which can indicate them.

...

Info
titleNote

In this script, we use some superclasses, which help us in code management. For more information, see the Usage of base groovy classes and utilities page.

...

In that case, we also start with point depended -dependent imports and define a constructor.

...

Execution of one parameter query on the decision table. To get the Decision Table Operation instance we use "employees" as a the name of the Decision Table file (with .dmn extension) and "employeeData" as an id of decision table element inside the DMN model, because DMN can contain multiple decision tables. Next, we set the context related to the executed decision table. Thanks to that we have an info about the decision table name or query, which helps to handle many any errors.

Code Block
languagegroovy
themeRDark
Map<String, Object> dtResEntry = dtResult.singleNonEmpty()
employeeHRNumberField.setObjectValue(dtResEntry.get("employeeHRNumber"))
departmentField.setValueByBusinessKey(dtResEntry.get("department"))
costCentreField.setValueByBusinessKey(dtResEntry.get("costCentre"))

At the finish, we get an entry as a map with output parameters from the result and use obtained values to fill related fields in the issue.

Attachments

View file
nameTestSetEmployeeDataPostFunction.groovy
height250
View file
nameemployees.dmn
height250