As per my project requirement i have changes the custom field from text to Labels, While i am updating the values of custom filed i am getting groovy script error. Please suggest what could be the approch.
Error Stack :
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Set
CustomField cfEcpId = cfManager.getCustomFieldObjectsByName("ECP ID Label").first();
cf.updateValue(fieldLayoutItem, issue, new ModifiedValue(currentValue, newValue), new DefaultIssueChangeHolder());
Ah, good, that's the right way to approach it.
The problem you have is that your script is not pushing the right type of data into the label field.
A string field is a string of letters. A label field is a collection of individual labels, each of which holds a string that is the name of the label.
In your code, the "newValue" going into the changeHolder needs to be a collection of labels. You'll need to read out the existing labels as a collection, then take the string you want to add to them, convert it into a set of labels you add to that collection, and post that back.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Atlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs