xl8bot
November 4, 2024, 7:07am
1
Originally asked by Patrick Mennecke on 27 January 2021 (original question)
From ServiceNow, I get the assignment group from the display value.
If a group is selected in ServiceNow that does not exist in Jira then a default value should be set.
In Jira a select list field is used.
Attached my incoming rule but this does not work
incomcing line in jira
issue.customFields.“Assignment Group”?.value = replica.assignment_group.display_value :? IBM-other
xl8bot
November 4, 2024, 7:07am
2
Answer by Tomás Martynowicz on 15 February 2021
You can always get an option from a select list using nodeHelper.getOption just like this:
def group = nodeHelper.getOption(issue, "Assignment Group", replica.assignment_group.display_value)
if(group != null) {
issue.customFields."Assignment Group" = group} else { issue.customFields."Assignment Group"?.value = "IBM-other"}
or using ternary operator
def group = nodeHelper.getOption(issue, "Assignment Group", replica.assignment_group.display_value)
issue.customFields."Assignment Group".value = (group != null) ? group.value : "IBM-other"
You can modify this sample to your needs. Check here for more details on nodeHelper.getOption