How to update Custom Field (Project Labels) with values with automation

Gert-Jan Turnhout MicroFix December 14, 2021

Hello community,

I'm new in Jira. I did install de App "Project Labels" using extra labels for my issues. Now I setup a automation rule for creating a new issue after a the first issue is Done.

Below the automation rule (sorry it is in dutch 🙃 )

The field is named "Project Label" and is also used in the JQL query for the IF statement. 

When I setup the values for creating a new issue I try to find the "Project Label" field but it isn't there. So I think I need to update/add this value in the advanced section using JASON.

I'm not really familiar with JASON so I did try it several times but it doesn't work.

 

Can any body help me out? I want tot add/update the Project Label field with the value "Jaarlijks" and "Operationele Planning"

 

Thank you very much :-)

 

Gert-Jan

  

 

 

automation-rule.jpgfield-not-listed.jpg

project-labels-isnot-there.jpg

 

insert-JASON.jpg

 

3 answers

3 accepted

1 vote
Answer accepted
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 15, 2021

Hi @Gert-Jan Turnhout MicroFix and welcome to the community!

Project labels, as tested them on my instance, receive a  long number instead of a string as Jira labels do. So, in order to add a label you have to add this json:

{
"update": {
"customfield_10151": [{"add": 2}]
}
}

Where you have to replace the customfield ID with your own label id, and you have to find out the ids of your labels. This can be done if e.g. you send an API request to get the issue in a json format:

https://YOUSUBDOMAIN.atlassian.net/rest/api/3/issue/ISSUE_KEY

This request will return a payload in which you will find the values of your labels. And once you find them, replace them on the first code I've pasted.

Alex

Gert-Jan Turnhout MicroFix December 15, 2021

@Alex Koxaras _Relational_ Hello Alex, thank for your answer. If I understand well, I cann't use the field name "Project Label" (this works in de JQL query) but I have to find out the "customfield ID" using the API request you gave.

I understand that I have to fill in my onwn "SUBDOMAIN" but what do I fill in at het ISSUE_KEY?  My tried my project code (im my case GMS) but notting received

I got the message : {"errorMessages":["De issue bestaat niet of je hebt geen toestemming om hem te bekijken."],"errors":{}}

What do I wrong?

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 18, 2022

Hi @Gert-Jan Turnhout MicroFix and sorry for the later reply, but I am kinda busy this period :/

About the ISSUE_KEY, you can use ANY issue key you want, in which you have already include some labels. E.g. ABC-123.

0 votes
Answer accepted
Gert-Jan Turnhout MicroFix February 7, 2022

Hello @Alex Koxaras _Relational_ find with API the right customfielID and also the correct value for the JSON script to ADD/UPDATE de customfield with the correct value. 

Automation woks for me. Thank for you help.

0 votes
Answer accepted
Gert-Jan Turnhout MicroFix January 17, 2022

Suggest an answer

Log in or Sign up to answer