I'm using ScriptRunner for Jira Cloud.
I set up a post-function to create a subtask upon transition. I would like to be able to choose the assignee from a list of current Jira users at the time the subtask is created (a drop-down list of all Jira users would suffice). I haven't been able to find anything like this in my searches. Can someone out there point me in the right direction or let me know whether this is not possible?
Separately, I've tried using the provided 'Must have Assignee' code, but that doesn't seem to do anything.
issue.fields.assignee != null
I can confirm that it is not possible to pop up a dialogue form which can be used to select the assignee when creating a subtask with ScriptRunner for Jira Cloud.
The reason for this is due to the fact that Atlassian does not provide the same Java API in Jira Cloud that they do in Jira Server and that Jira Cloud only contains a rest API.
Unfortunately, the Rest API provided by Jira Cloud does not provide us with the API's that would be required to create dialogues or the functionality to dynamically populate fields based on values selected in other fields like you can do with the Behaviours feature on Jira Server.
You can see more detailed information on the differences between ScriptRunner for JIRA Cloud and ScriptRunner for JIRA Server inside of the documentation page located here.
I can confirm to set the assignee that you would need to write some code to extract the value from the user field and to save this to a variable in your script.
Your script would then need to make a put request to the issue API to update the issue and to the assignee to the value, you saved in your variable.
I can confirm that we have an example script located here which shows how to set the assignee to the value of a user picker field and you will be able to use this as a reference guide to help create the script that you require to achive your requirement.
Thanks again, Kristian.
When trying the code snippet, I get the following error on line 31:
[Static type checking] - No such property: null for class: sr.json.issue.issuelinks$3$3 @ line 31, column 21.
I'm not sure if this is an issue in my environment or with the code snippet itself.
If you can help, I'd appreciate. Else, that's fine - you've already given me a lot of information. :)
Thank you for your response.
I can confirm that if you are using the built-in Create Subtask post function provided by ScriptRunner for Jira Cloud that you can add some code in the Additional Code Box to set the assignee.
This code will get the accountId value off the user picker field on the parent issue and will set it as the assignee.
I can confirm that we have some sample code located here which shows how to do this and that you can use a reference.
In this sample code, you will just need to change customfield_1234 to be the ID for your user picker field.
I hope this helps.
Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events