Script Runner - Clones an issue and links

Hi All

I'm after some help for the script runner plugin by Jamie Echlin

I am using the builtin template ‘Clones an issue and links’ but I want the Target Project to be fed from a custom field (which is a multi-select containing the options of all the available JIRA projects)

Any help would be gratefully received 

6 answers

1 accepted

This widget could not be displayed.

You may solve the problem by creating a custom field "Project select (single)".

In the section "Additional issue actions" of the "Clones an issue and links" post function:
Screen Shot 2015-04-01 at 17.36.12.png

 

you may want to add something like:

def cfObj = customFieldManager.getCustomFieldObject('customfield_10102')
def cfValue = issue.getCustomFieldValue(cfObj)
if (cfValue != null){
    issue.setProjectId(cfValue.id)
}

Where 'customfield_10102' is your project select field ID.
If no project is selected it will use the default one on "Target Project".

This widget could not be displayed.

Hi @Matt C,

Can I ask why do you need to use a Custom Field instead of the current Target Project field?

This widget could not be displayed.

Thanks @Cesare Jacopo Corzani, that works very well.

 

 

This widget could not be displayed.

Hi @Alejo Villarrubia [Adaptavist]

Thanks for your reply

I would like to do this as part of a workflow transition, so the user interactively selects their target project in a transition screen and then the script takes that input for use in the 'Target Project'  otherwise the script will always use the same project I think

.

 

This widget could not be displayed.

Hi @Jamie Echlin [Adaptavist],

Would you be able to help me at all with this one?

Many Thanks

This widget could not be displayed.

Hi @Cesare Jacopo Corzani

This doesn't appear to work in JIRA 7 - seems to have a problem with issue.setProjectId(cfValue.id). Would you have any ideas?

Error below followed by the code 

image2015-12-18 16:2:11.png

 

def cfObj = customFieldManager.getCustomFieldObject('customfield_11700')
def cfValue = issue.getCustomFieldValue(cfObj)
if (cfValue != null){
issue.setProjectId(cfValue.id)
}

 

Many Thanks

 

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

106 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you