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 "email@example.com" : "firstname.lastname@example.org", "email@example.com" : "firstname.lastname@example.org", ] // look up the corresponding email, default to email@example.com def targetUserEmail = leftToRightAssignee[left.issue.assignee?.email] ?: "firstname.lastname@example.org" // 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