Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

ScriptRunner Cloud - Select Assignee for Subtask

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

Thank you.

1 answer

1 accepted

0 votes
Answer accepted

Hi Manoj.abraham, 

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.



Thank you, Kristian. I appreciate your detailed answer.

Is it possible for me to set the assignee based on the value in a custom field then? I've been searching for this is as well, but all solutions seem to refer to Jira APIs.

Thanks again.


Hi Manoj,

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. :)



To clarify my last comment, I added the code snippet to the create subtask ScriptRunner post function.

Hi Manoj,

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.



Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

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 ...

308 views 0 9
Join discussion

Community Events

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

Events near you