This article describes how to write a script rule in Exalate visual mode.
Script rules can be used when the standard mapping rules are not sufficient to cover the use case.
Creating a script rule is straightforward.
- Edit your visual connection
- Select the rules
- Select the 'add script'
How does it work
The scripts are groovy based - meaning that all groovy structures can be used to define the behaviour of the mapping.
For instance - if a mapping is needed between the assignees of side with instance name 'left', and side with instance name 'right'.
Following code snippet will implement the mapping
// define the mapping def leftToRightAssignee = [ // left Assignee ---> right Assignee "firstname.lastname@example.org" : "email@example.com", "firstname.lastname@example.org" : "email@example.com", ] // look up the corresponding email, default to firstname.lastname@example.org def targetUserEmail = leftToRightAssignee[left.issue.assignee?.email] ?: "email@example.com" // assign to right issue right.issue.assignee = nodeHelper.getUserByEmail(targetUserEmail)
Below you can find examples of the most common field types that are usually synchronized