Forums

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

Automation - set field value

Julian Reichle December 26, 2022

Hello,

we had an automation rule runnign for the last months. The goal of the rule is to copy the values of the system field Organizations to a custome field "Customer organizations".

We need the Customer organizations field to better structure, filter, search tickets.

Example:

Organization is named "Company123 [Germany]" --> our internal rule to name organizations is always the company name (e.g. Company123) and then space and country in [ ]

The rule copied the values as labels in the field Customer organizations. So the result was:

Label1: Company123

Label2: [Germany]

 

Since a few days we receive the message:

Edit issue
Error editing issues
SSD-922 (The label 'TEST ORGANIZATION [Switzerland]' can't contain spaces. (customfield_10175))
The rule was set up without any advanced settings. Just like
- when: value changes
- then: create valirable
- and: edit issue field
Does anybody know what happend? And how could a advanced settings rule look like?
Thanks in advance!

4 answers

0 votes
Erin Quick-Laughlin
Contributor
May 23, 2023

I believe labels cannot have spaces at all.  We store values containing spaces, as values with spaces replaced by dashes.  Then when pulling the value, we replace the dashes with spaces.

Add: 

{{webResponse.body.idea.categories.name.replace(" ","-")}}

But we have the same issue when there is more than one value, but we're trying to convert an array of values in a webresponse to labels. 

Our data comes over as this json

"categories": [
{
"name":"Baseball Game",
"created_at":"2022-12-16T16:13:26.436Z
},
{
"name":"test",
"created_at":"2022-11-02T17:09:27.147Z
}
]

 

If we have a single value, like "Baseball Game" it will come through as "Baseball-Game"

But with two values, we get the same error, suggesting there is one string being submitted, e.g. 'Baseball-game, test'

Which suggests it's a question of how to iterate correctly using smart values functions, beyond just the .replace(), because after the replace, we'll need to convert to a collection of strings.  

So far, the closest I've come is using .asJsonStringArray, as in

{{webResponse.body.idea.categories.name.replace(" ","-").asJsonStringArray}}

Which will generate the array, but also encapsulated as a single string, so we don't have two labels, but one that looks like this:

'["Baseball-Game","test"]'

Ultimately, I decided to break the problem apart to separate Edit Issue calls, wrapped by Advanced Branching, so that we could submit them one a time, still replacing the spaces with dashes.

Screenshot 2023-05-23 095132.pngScreenshot 2023-05-23 095205.png

0 votes
Julian Reichle January 4, 2023

Hello,

anybody out there, who can help?

I tried to use the split operator, but not working out.

{{debug}}{{issue.Organizations.name.split(" ").first }}

I always get a list and not only the first value

Snag_d954016.png

0 votes
Shay Gabizon December 26, 2022

hey Julian,

I've just noticed I have the same problem and I thought maybe it was something I did wrong, but I tested everything and couldn't solve this problem.

I've also created a ticket for Atlassian support, but until they'll reply, If you find any solution for this, please share it. I'll do the same

thanks

0 votes
Julian Reichle December 26, 2022

 

see here the ruleSnag_a13884a.png

Shay Gabizon February 2, 2023

Screenshot 2023-02-02 151658.png

Suggest an answer

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

Atlassian Community Events