Forums

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

Assign value to "Labels" field using app script in Google Sheet as part of Google Form automation

Iryna Levchenko
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 16, 2021

Hi everyone,

I'm having troubles to assign value to "Labels" field in Jira using Google App Script as part of Google Form/Sheet integration to create Jira Issue. 

In other words, the app script runs when google form is filled in. It creates jira ticket and I'd like one of the form's fields to be written to the "label" field in Jira. 

extract of the code: 

 var IssueData = {"fields"                           
  {
"project": { "key"JiraProject },               
   "summary"JiraTitle,                                                  
  
"issuetype": {"name""Task"},             
  "description"LongDescription,                                      
"labels" : {"value" : LabelName
}
};

 

1 answer

0 votes
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 19, 2021

Hello @Iryna Levchenko ,

For the Create issue API via the endpoint POST /rest/api/2/issue the formatting for the labels should be like this:

"labels": [ "label 1", "label 2" ]

And there is a full working example in the API documentation at the link POST /rest/api/2/issue.

But one caveat that gets a lot of people when adding labels on a create issue API  that might be causing an issue for you is that if the labels field is missing from the create issue screen on the project you would receive a 400 bad request error attempting to place a value in the missing field, and "labels" field is not on the create issue screen by default.  So double-check and verify the field is present.

Also just as a reference point in case anyone else runs into this thread looking for a similar solution with questions about the Google Sheets external API integrations, the  documentation for this can be found here:

Regards,
Earl

Suggest an answer

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

Atlassian Community Events