Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Set value in label custom field

Dan27
Contributor
June 25, 2019

Hello,

I created a custom field label type:

I would like to set a value using script runner (script listener).

 

How can I set custom field value to a label field using script?

 

BR,

Daniel Mor

1 answer

1 accepted

0 votes
Answer accepted
miikhy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 25, 2019

Hi @Dan27 ,

You can have a look at this other thread where there are options for Jira 6+ and Jira 7+ : https://community.atlassian.com/t5/Jira-Core-questions/How-do-I-add-a-label-in-post-function-using-scriptrunner/qaq-p/455147

That should also work in Jira 8+. Please scroll till the end of the answers as the Jira 7+ API changed a bit the script (all is explained).

Let us know if you still have issues!

Cheers

Dan27
Contributor
June 25, 2019

Hi @miikhy ,

It's not helping for me, I have a custom field , called "x" , label type.

In this example, it makes a normal label, not a specific custom field 'X'...

 

Do you have an idea?

Daniel

alex August 28, 2019

Hi, Daniel! try this:

issue.setCustomFieldValue(labels_field, [new Label(null, issue.getId(), labels_field.getIdAsLong(), "Label")] as Set) 

more can be found here:

https://community.atlassian.com/t5/Agile-articles/Three-ways-to-update-an-issue-in-Jira-Java-Api/ba-p/736585 

Like Sergio Marcos Sendino likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events