Setting up a rule to match non related field in jira to particular issue types

Originally asked by Pahan on 01 September 2020 (original question)


setting up a rule to match non-related field in jira to particular issue types
If we have an issue type called Environment in the source JIRA and we wan to add a rule as

if 'Environment ’ is having values “X”, “Y”, “Z”
then replica JIRA issue type should be set to ‘Non-Prod issue’

if 'Environment ’ is having values “P”
then replica JIRA issue type should be set to ‘Prod issue’

Thanks in advanceSource: Jira Cloud (old community)


Answer by André Leroy-Beaulieu Castro on 01 September 2020

Hi Pahan,

Thanks for raising this question!

On the Jira that will be sending the Environment field, Outgoing filter:

replica.customFields."Environment" = issue.customFields."Environment"

Incoming filter in the receiving Jira:

def environmentMapping = ["X":"Non-Prod issue",
"Y":"Non-Prod issue",
"Z":"Non-Prod issue",
"P":"Prod issue"]

def environmentValue = replica.customFields."Environment"?.value

if (firstSync) {
	issue.projectKey   = "TEST"
    issue.typeName     = nodeHelper.getIssueType(environmentMapping[environmentValue])?.name ?: "Non-Prod issue"
}


This should work for the case you are describing :smile:

Thanks,

André