Forums

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

Script Runner Behaivour - add string to labels field

arielei
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.
October 3, 2025

Hey Community,

In Script Runner Cloud, how can i set the value of the "labels" field to a string that i have?

for example i'm trying to do this:

getFieldById('labels').setValue('LEFTFIELD')

 

But getting the error:
Argument of type 'string' is not assignable to parameter of type 'LabelsField'

 

This is happening on the "On Load" function on the create screen.

 

how can i fix this?

Thanks

Ariel.

1 answer

1 accepted

1 vote
Answer accepted
Kristian Walker _Adaptavist_
Community Champion
October 3, 2025

Hi Ariel,

I can confirm that in Behaviours for ScriptRunner Jira Cloud you must set the label field using an Array of strings e.g ["label-1","label-2"] as described in the UI Modification API documentation page here

You can also see the structires to use to set field values inside our documentation page here and this will help you to see what format to use when writing behaviours scripts.

This means in your script if you do something similar to below then it will work.

getFieldById('labels').setValue(['LEFTFIELD']) 

I hope this information helps.

Regards,

Kristian

arielei
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.
October 3, 2025
Kristian Walker _Adaptavist_
Community Champion
October 3, 2025

Youre welcome :)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events