I'm looking to use Scriptrunner Behaviors in Cloud to set the Component of an issue to a default value on Load on the Create screen.
The solutions I've seen for default values are either for strings (component not being able to be set by a string) or for setting after creation (we want to pre-fill on the Create screen).
Any guidance on how to accomplish this would be greatly appreciated.
Thanks!
Hi @Anthony Giordimaina ,
To do this all you would need to do is create a Behaviour for the project and issue types you want to cover, and then in script select "On load" and "Create View". Then the code would be:
getFieldById("components").setValue(["COMPONENTID","COMPONENTID"])
So will look like this:
You can read more on how to get/set every field type we support, as well as all the other methods available to you here: https://docs.adaptavist.com/sr4jc/latest/features/behaviours/behaviours-api
If you can't find your component ids (took me a little bit) you can enter this into your browser and it will output all your components with their IDS:
https://{DOMAIN}.atlassian.net/rest/api/2/project/{PROJECTKEYORID}/components
Let me know if this works for you!
Kind regards,
Bobby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the linked document is very helpful
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.