Hello Everyone!
I have been pounding my head against a wall for days just trying to learn how to do a few basic things in a groovy script. I have had some luck with post transition scripts, but now I am trying to do something that seems like it should be simple in an automation script. I am just trying to set a value on a field - in this case a checkbox (and eventually a few other custom fields).
I have tried at least 30 examples from here on the forum, but all show me an error on the setCustomFieldValue and I do not understand why. I have cut my code down to the bare minimum to try and get it working, so just the imports, the definitions, and the field I want to set. The set line (which I have tried at least 7 variations of) always has the red mark indicating an error. I am suspecting this is something simple, but has been buried in other examples so that my searches never find the small thing I need.
I have this in a scriptrunner automation set to run when the issue created and when I use a specific entry in the Summary, It is entered under a "Execute a ScriptRunner script":
Welcome to the Atlassian Community!
https://library.adaptavist.com/entity/basics-updating-customfields?tab=dataCenter shows us how to set almost every type of custom field that there is in Jira.
Your code does seem to be using HAPI in Scriptrunner though - is your version of Scriptrunner new enough to have HAPI? If it is old enough to be pre-HAPI, you'll need to change your code to do it natively with the Jira API.
I have referred to https://library.adaptavist.com/entity/basics-updating-customfields?tab=dataCenter many times, and that is how the setcustomfield above is formatted. It appears my version of scriptrunner is 7.7.0, so I don't know about HAPI (I know I am not HAPI...). The setcustomfieldvalue does work in post-functions though (using the issue.set{} ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.