Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner clone and link an issue

Brooke Anglin March 12, 2019

Can someone help me ? I have set up the configuration but when I create issues nothing happens ? What I need is when monitoring tool = Not Applicable or monitoring tool = None in the MOC Turnover  I need a ticket cloned in our monitoring project

 

It wouldn't let me attach a screen shot but below is the details of what is currently set up

 

condition = issue.projectObject.key != 'NET' & issue.issueType.name != 'Incident 2' & cfValues['Monitoring Tool'] in ['None', 'N/A (Not Applicable)']

 

Target project = Monitoring

Target Issue Type = Incident

 

Additional Issues and Actions = def cf = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Incident Type'}
issue.setCustomFieldValue(cf, sourceIssue.getCustomFieldValue(cf))

 

Issue Link Type Direction = relates to

 

 

Any help would be greatly appreciated !!!

1 answer

0 votes
Matthew Clark
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 3, 2019

This was answered via a support ticket with the following:

As the "Monitoring Tool" field is a Multi-Select list, one way to check if it contains specified values in a Post Function or Listener condition would be like this:

import org.apache.log4j.Logger
import org.apache.log4j.Level
def log = Logger.getLogger(getClass())
log.setLevel(Level.DEBUG)

List<String> myList = ['None-No alert triggered', 'N/A (Not Applicable)-Not Monitored by GTS']
def chosenList = cfValues['Monitoring Tool']*.value

log.debug("mylist = " + myList)
log.debug("chosenList = " + chosenList)

Boolean selectionIsInList = chosenList.any{ item ->
    myList.contains(item)
}
log.debug("selectionIsInList = " + selectionIsInList)

Boolean result = issue.projectObject.key == 'NET' && issue.issueType.name == 'Incident 2' && selectionIsInList

log.debug("result = " + result)


return result

 

The debug logging can be removed after you have checked it works as expected.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events