How to delete a label from an issue?

I am trying to add functionality in my plugin to remove a label from an issue.

Any help?

5 answers

1 accepted

Create a new Set<String> that contains all but one label, that is the one to be deleted.

Call LabelManager.setLabel().

or use MutableIssue to use mutableIssue.setLabels(Set<Label>)

(i don't prefer this one)

which version of Jira you are using?

currently m workin on 4.1 but planning to shift to 4.4 soon

currently m workin on jira 4.4.1

following way you can delete labels from issue

issue.getLabels();

it will return set of lables which are appended to issue from that set you can delete label if ur deleting one label you have to update remaining set using

issue.setLabels(setof labels);

if you are deleteing all labels then you have to set labels with empty set

let me know if have any question

cheers


i cudnt find any issue.setLabes() method....however i gt came across LabelManager.setLabels()...however it takes Set<String> of label so i need to convert all labels i want to add to string

if you are using jira 4.4.1 then you should get that methods, you can find the API at

http://docs.atlassian.com/jira/4.4.1/com/atlassian/jira/issue/Issue.html

still if you have questions let me know

sory fr d discontinuity...but dere were sm priority tasks at hand...

as i said.... i have d getLabels() method....but not setLabels(set)

rather i cudnt find any setter for Issue

Normally For Issue Object don't have any methods to set values. you have to use Mutable Issue to set values,

you can find that method at http://docs.atlassian.com/jira/4.4.1/com/atlassian/jira/issue/MutableIssue.html#setLabels(java.util.Set)

still if you have question let me know

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

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

73 views 0 5
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you