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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to auto assign a label based on a custom field value


I have a custom field called "Is Change Required?" which has "Yes" and "No" as options. If the response is "Yes" I would like to automatically assign the label "ChangeRequired" to the ticket. The question is on a request through a Service Desk Portal. 

How do I do this using either a postfunction or a behaviour?

I am on Jira Data Center so I do not have access to the Autonation Plugin unfortunately. 

2 answers

0 votes
Pramodh Community Leader Feb 15, 2021

Hi @Anuj Balaji 

Install Automation of Jira Lite and have automation work done for you!

You can set the automation as follows,

If the custom field is changed, you can edit the label field.


Hi @Pramodh : Thanks for responding. Like I said, unfortunately, Automation for Server Lite does not work on Data Center. 

Pramodh Community Leader Feb 15, 2021

Apologies didn't see the last sentence!

Thank you @Pramodh - I was hoping to exhaust all my options with Scriptrunner before having to spend the money on the Plugin.

Pramodh Community Leader Feb 15, 2021

Hi @Anuj Balaji 

Please accept the answer!



I would still like to keep this open for other potential solutions

Pramodh Community Leader Feb 15, 2021

I'm waiting! to see best solution 😎

0 votes
Daniel Ebers Community Leader Feb 16, 2021

Hi @Anuj Balaji
I am not sure about the Service Desk Portal-part but for a postfunction in a workflow using Script Runner it works fine in my tests like this (Groovy):

import com.atlassian.jira.issue.label.LabelManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue

def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()

CustomField radioButton = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Change");

if(radioButton == null)
return false

LabelManager mgr = ComponentAccessor.getComponent(LabelManager.class)
mgr.addLabel(user,, 'ChangeRequired', false)
return false

As soon as the issue has the value "yes" for the Custom Field "change" a label is set during a transition of your choise using a post function.

You might need to tweak it a bit for Custom Field names and possible further requirements that might come up in future - the above one is pretty basic.


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