I need to create a label on the fly (e.g., during issue creation) in Jira Service Management.
I have the automation on issue creation setup and for labels I need to make it a combination of Text and 2 custom fields
Something like:
{
"update": {
"labels": [
{
"add": "Thank you and your details are " {{issue.fields.CustomField_13204.value}} "-" {{issue.fields.CustomField_13201.value}}
}
]
}
}
So I would like the label added to be "Thank you and your details are - Gemini - June".
The error I get in automation is: Error while parsing additional fields. Not valid JSON
Note: every example I have seen on this is either setting a label with just text, or setting a custom field's value, but never setting labels from text and custom field values.
OK here is the answer: if the customfield_13204 and 13201 are just text fields, there is no .value to use, nor any asJsonString.
{
"add" : "Confirmed-{{issue.Customfield_13204}}-{{issue.CustomField_13201}}"
}
Got: Confirmed-Gemini-June
Thanks all for getting me to the one yard line!
you cannot have spaces in a label and it seems odd to have "Thank you and your details are" as part of a label. Why not simple "Gemini-June"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jack,
Thanks for pointing out the spaces, but yes, we can get: "Confirmed-Gemini-June"
But I keep trying to get my text custom field values as JSON and without any good examples, I keep getting Not valid JSON.
Latest snippet:
"labels": [
{
"add": "Confirmed-" {{issue.CustomField_13204.value.asJsonString}} "-" {{issue.CustomField_13201.value.asJsonString}}
}
]
To be sure, cf 13204 has text value of "Gemini" and cf 13201 has text value of "June"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adding to Jack's suggestions...
The problem appears to be the use of quotation marks in your JSON expression. You should be able to just wrap the value once and include the smart values inside, perhaps like this:
"add": "Confirmed-{{issue.CustomField_13204.value}}-{{issue.CustomField_13201.value}}"
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bill,
Thanks and though now it does not error, it's getting blanks for those to cfs.
I get "Confirmed--" as a label but my issue shows the values of 13204 and 13201 and those indeed have "Gemini" and "June".
I tried them using: {{issue.CustomField_13204.asJSONString}} and I get the label of:
Confirmed-"Gemini"-"June"
I'm guessing the asJSONString is putting the quotes around those values so we are close, but I want Confirmed-Gemini-June.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.