Hello,
I am not used to scripting and I need help here for something which is probably simple.
I receive issues by email starting with : 33 - yada yada
I need to retrieve the first 2 characters and put it into another custom field.
I knew how to do that on Jira server with JMCF, a simpe : issue.get("summary").take(2)
would do the trick, but in the cloud I think I got to use a scriptrunner listener but how...
well I'm lost.
Regards,
Philippe
Hi Philip,
Thank. you for your question.
I can confirm that the easiest way to see how to get values from fields is to navigate to the Script Console and to click on the text which says Get Issue Fields link in the Examples section below the code box.
This will then populate the code box with a script where you can specify the issue key and run this script which will return the JSON structure of the issue fields and will allow you to see how to return the summary of an issue.
You can then save the summary to a variable and use the substring method that Groovy provides as described here to get the first characters of the summary.
I would also recommend using the Update Issue example on the Script Console to test updating the field you require once you have got the summary from the issue.
I hope this information helps.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.