Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automatic assignment based on custom field


I have a problem and I don't know how to solve it. Maybe you have any ideas?

I would like to automate Jira Workflow and create automatic assignment in some situations to make sure that case is left unassigned.

Let's say I have custom field in Jira Software called Service Team  with options like: Logistic, IT, Finance, etc. 

For each Service Team I have dedicated person who is responsible for accepting tickets. It's always same person for each Service Team i.e. for Logistic it's Andrew, for Finance it's Jake and so on. 

Do you know how I can manage that after workflow transition to a specific state case will be assigned automatically to specific person depends on Service Team custom field value?

I tried with post function but I couldn't find option to make it.

Do you have any advice for me?

Thanks in advance

4 answers

1 accepted

5 votes
Answer accepted

Hi Wojtek,

There's a couple of ways to do this:

1) Create a scripted post function that will set an assignee depending on your custom field value. This will require a 3rd party addon like ScriptRunner or JMWE.

2) Create an automation rule that will trigger when your issue is transitioned and set an assignee based on your custom field value. Automation for Jira is required for this approach.

3) If your are using Jira Service Desk, then you can do it using standard JSD automation which is available out of the box.

Please mark the solution as 'Accepted' if it resolved your issue.

Hi Ivan,

I am trying to do option 1, as my client has ScriptRunner but does not want to purchase any other add-ons. I am pretty new to using scriptrunner, how would I go about writing the code for this? I can't find it anywhere online

@Callum Carlile _Automation Consultants_

Sure thing. Please advise your custom field type and when do you want this to trigger?


The custom field is a single user picker. I would like this selected user to be assigned to a sub-task which is created automatically from a post function in a different workflow (I assume this is what you mean by trigger)

Assuming your custom field is IN your sub-task (and not in its parent issue for example) the code would be as follows:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.user.ApplicationUser

ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
CustomField customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("fieldName")
ApplicationUser cfValue = issue.getCustomFieldValue(customField)
if (cfValue){
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)

 However, if your subtask is also created via script, the best approach would be to modify that script so the subtask is created already with an assignee set.

Otherwise use the code I provided as a post function for your subtask's 'Create' transition. Make sure you place this post function last.

@Ivan Tovbinis it possible to create similar script but for a bit complex conditions?

I want to set auto assignment for issue for certain user depending on custom field value (cascade type, two values).

For example, if value = A-a or B-b or C-c etc. assign to user1

if value = D-d or E-e assign to user2


How it

@Ivan Tovbin how can I do this using option 3?


3) If your are using Jira Service Desk, then you can do it using standard JSD automation which is available out of the box.

Hi, I get an error ComponentAccessor has not been initialised.

how to resolve it.

Go to the project setting 


Create new rule 

Issue created 

Assign issue << Specify user << Name of the user

in conditions 

issue fields condition

field: service team then Set the condition :equal and Value : to one of your values 

rememeber you have to create new rule for each user. 

finally a good solution

Like Muhammad likes this


May I ask you the code of script runner to assign a specific assignee based on custom fields? If it is possible through 'workflow properties', please let me know!!

Thank you for your help!

Best regards,


Hi Ivan,

thanks for your reply. I used your second proposal and it works great. Thanks for your help!

@Wojtek_Misiarz - Could you please help how to achieve this.

If I create a Jira Issue and select a module and sub-module, can the issue be auto-assigned to a particular user based on the sub-module? 

Suggest an answer

Log in or Sign up to answer

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