Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 update custom field Label manger field Null values to label type value for multiple issues?

Hi, I'm trying to update multiple issues based on JQL query, for fields which are null values to value ['None'] is it possible to change the null value to label type ['None'] value? when I run the code I'm getting log error as shown in the screenshot. I'm new to the groovy script and I implemented this code by searching the internet. please help me in this I got struck here from long.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.web.bean.PagerFilter
import org.apache.log4j.Logger

def log = Logger.getLogger("com.acme.workflows")

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def query = jqlQueryParser.parseQuery("category = Projetcategory and \"Shared Labels\" is EMPTY")

def results =, user, PagerFilter.getUnlimitedFilter())
results.getIssues().each {documentIssue ->
def issue = issueManager.getIssueObject(
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def changeHolder = new DefaultIssueChangeHolder()
def tgtField = customFieldManager.getCustomFieldObjects(issue).find { == "Shared Labels"}
def String newValue = "[None]"
tgtField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField), newValue), changeHolder);



1 answer

0 votes

The second line of the error is something you are going to see a lot.

You have not realised that the field you are trying to put values into is multiple entry field (you can select 0, 1 or many options for it).  This means you have to give it a list of options to store.

The error "java.lang.string cannot be cast to java.util.set" is saying that you can't "cast" between what you've given it and what input it requires.  Casting is "changing the variable type from one to another".

You'll need to build an empty Set and feed that to the changeholder instead of a string.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

177 views 2 1
Read article

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