Automation for Jira use JSON to update 2 Cascading select custom fields

Alexander Pappert
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.
June 23, 2020

Hi,

I can use this to update a Cascading select custom fields

 

{
"update": {
"field01": [
{
"set": {
"value": "{{triggerIssue.fields.field01.value}}",
"child": {
"value": "{{triggerIssue.fields.field01.child.value}}"
}
}
}
]
}
}


How can I update 2 or more fields within the same JSON?

I need to update all with one JSON command, because otherwise I get the loop detection error from my following rule

 

this does not work

{
"update": {
"field01": [
{
"set": {
"value": "{{triggerIssue.fields.field01.value}}",
"child": {
"value": "{{triggerIssue.fields.field01.child.value}}"
}
}
}
]
}
}

{
"update": {
"field02": [
{
"set": {
"value": "{{triggerIssue.fields.field02.value}}",
"child": {
"value": "{{triggerIssue.fields.field02.child.value}}"
}
}
}
]
}
}
 

 

3 answers

1 accepted

1 vote
Answer accepted
Alexander Pappert
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.
June 24, 2020

I finally got it after a lot of testing:

{
"update": {
"01": [
{
"set": {
"value": "{{triggerIssue.fields.01.value}}",
"child": {
"value": "{{triggerIssue.fields.01.child.value}}"
}
}
}
],
"02": [
{
"set": {
"value": "{{triggerIssue.fields.02.value}}",
"child": {
"value": "{{triggerIssue.fields.02.child.value}}"
}
}
}
],
"03": [
{
"set": {
"value": "{{triggerIssue.fields.03.value}}",
"child": {
"value": "{{triggerIssue.fields.03.child.value}}"
}
}
}
],
"04": [
{
"set": {
"value": "{{triggerIssue.fields.04.value}}",
"child": {
"value": "{{triggerIssue.fields.04.child.value}}"
}
}
}
]
}
}
0 votes
Alexander Pappert
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.
June 23, 2020

well, this one doesn't produce the "Error while parsing additional fields. Not valid JSON."

But it only updates field01 and not field02

 

@Danyal Iqbal 
i added a comma after the update and then it worked

{
"update": {
"01": [
{
"set": {
"value": "{{triggerIssue.fields.01.value}}",
"child": {
"value": "{{triggerIssue.fields.01.child.value}}"
}
}
}
]
},
"update": {
"02": [
{
"set": {
"value": "{{triggerIssue.fields.02.value}}",
"child": {
"value": "{{triggerIssue.fields.02.child.value}}"
}
}
}
]
}
}
0 votes
Danyal Iqbal
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.
June 23, 2020

try this

{
"update": {
"field01": [
{
"set": {
"value": "{{triggerIssue.fields.field01.value}}",
"child": {
"value": "{{triggerIssue.fields.field01.child.value}}"
}
}
}
]

"field02": [
{
"set": {
"value": "{{triggerIssue.fields.field02.value}}",
"child": {
"value": "{{triggerIssue.fields.field02.child.value}}"
}
}
}
]
}
}
Alexander Pappert
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.
June 23, 2020

got the same error

Error while parsing additional fields. Not valid JSON.

Suggest an answer

Log in or Sign up to answer