Cloning an Issue script is reporting error when trying to modify variables and custom fields

Deleted user September 29, 2014

Hi

I am trying to use the built in cloning of an issue script that comes with the script runner service to create a process that will do the following:

"Upon the closure of a Priority 1, clone that issue, set the cloned issue type as change request, modify the priority of the clone as well as taking the value from a custom field and putting it in the summary field"

That is a brief outline of what I am trying to achieve, but am running into issues when it comes to the section of the clone scrip[ting service that deals with 'Additional Issue Actions', which is where i want to modify the various fields of the clone to contain different values, some of which are in Custom fields.

 

However, when ever I try to use the examples provided below the field e.g.Set Issue Summary or Set Custom Field and modify them to achieve my goal or even use the defaults as a way of testing, they always fail and produce the same error in the JIRA logs saying:

"ScriptException: groovy.lang.MissingPropertyException: No such property: set for class:" whenever it gets to the part of the script where the 'issueInputParameters' command is called.

Any help on this would be greatly appreciated and please ask for more information on the issue if required.

7 answers

1 accepted

0 votes
Answer accepted
Deleted user November 24, 2014

The code below is based on the latest version (3.0.5) of the Script Runner plugin. I do not know if it works with your version. // set the issue priority to High, provided the ID is 2 issue.setPriorityId("2") // get the custom field def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'NAME OF FIELD'} // set the summary to the custom fields value issue.summary = issue.getCustomFieldValue(cf).toString()

0 votes
Geert Graat
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.
September 30, 2014

Hi Adam, The code below is based on the latest version (3.0.5) of the Script Runner plugin. I do not know if it works with your version. // set the issue priority to High, provided the ID is 2 issue.setPriorityId("2") // get the custom field def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'NAME OF FIELD'} // set the summary to the custom fields value issue.summary = issue.getCustomFieldValue(cf).toString() Regards, Geert

0 votes
Deleted user September 29, 2014

Hi Guys Thanks for your input. I didn't realize that i had not provided the version information, here you go: Jira Version: 6.2.7 Script runner version: 2.1.17 Thanks Adam

0 votes
JamieA
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.
September 29, 2014

Geert is right here... issueInputParameters was introduced to script runner when it became available in jira. Maybe you have an old version of jira. Please supply versions of both jira and SR. The info to provide is here: https://jamieechlin.atlassian.net/wiki/display/GRV/Getting%20Help#GettingHelp-Supportrequests

0 votes
Geert Graat
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.
September 29, 2014

Hi Adam, What version of the Script Runner are you using? Because I am using the latest version and I notice that the example code that I see is different from the example code that you provide. I see corrections to apply on your code, but let's first check that it will work with your version. Geert

0 votes
Deleted user September 29, 2014

Hi Geert Thank you for answering. In answer to your queries.......Yes, if the additional actions are left blank then the issue is cloned and the condition entered works correctly as well as the drop down option to change the issue type of the cloned job. Below is the code i have already tried, with an explanation for each: "issueInputParameters.setSummary('new summary')" - These two lines are the default for clicking on the example of changing summary. "issueInputParameters.setSkipScreenCheck(true) " - I want to be able to set the summary field to contain the contents of a custom field that is part of the clone. "set.issue.priority == '2. High'" - This is what i attempted to use to change the priority of the cloned job "def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Client'} issueInputParameters.addCustomFieldValue(cf.id, 'Phoebus Internal')" These last two lines are just the default code lines entered by the example to change a custom field with my modifications of the values, that is it. As mentioned from the original question I believe that the error may be occuring when it hits the command 'IssueInputParameters', but other than that I dont know. Thanks again Adam

0 votes
Geert Graat
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.
September 29, 2014

Hi, Just to understand: if you do not specify any additional actions, is the issue then cloned correctly (just without the correct priority and modifying the summary)? Does your condition work? Could you post the code that you specified in the additional actions field? Geert

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events