Is it possible to update both values of a Cascading field based on text in an issues Description?

SheLa Newburn January 13, 2023

I am wondering if there is a way to create an automation in Jira that updates both values of a cascading field based on text in the Description. Long story short, I have created a Slack form that generates a Jira issue, but due to certain requirements, it is a manual form so every answer to a question goes into the "Description" field.

I would like to reference a part of said text in the description field in the automation so that it then updates the corresponding Cascading, custom field.

I've gotten halfway there but my JSON gives me the "Error while parsing additional fields. Not valid JSON."

So heres how I want it to work ideally:

  • When an Issue is Created (Trigger);
  • If the description field contains the words "Fake Text" (If Block);
  • My automation should then Edit (Edit Issue);
  • And consequently update both values of my cascading field.
  • "Fake Text" will control both values for the field.

 

Below is the JSON I have tried thus far:

1.

"fields": {
"customfield_12345" : { "value": "fake_text1", "child": { "value" : "fake_text2"} }
}
}

 

2.

{
  "set": {
    "customfield_12345": [
      {
        "set": {
          "value": "{{triggerIssue.fields.Sample Cascade.fake_text1}}",
          "child": {
            "value": "{{triggerIssue.fields.Sample Cascade.child.fake_text2}}"
          }
        }

 

I think my biggest hangup is not knowing where/how to reference the custom field ID (Another cascading field exists by the same name) and also not understanding if the "Fake Text" should have a space between words, or an underscore in the JSON.

Any help is greatly appreciated! Thank you!

3 answers

1 accepted

0 votes
Answer accepted
SheLa Newburn January 18, 2023

Hi again! Figured out what went wrong here. Just sharing in case it helps someone else

1. I checked the actual custom field value configuration and found that the option I was testing had an extra space at the end. I deleted it and the below code worked flawlessly afterwards.

2. Another notes is that I thought I had to use underscores instead of spaces in the value names but the spaces worked just fine. 

Successful JSON below

{
"fields": {
"customfield_12345": {"value": "First Value Name Here", "child": {"value": "Second Value Name Here"}}
}}
} 

Thank you @YogeshKR for your help as well!

0 votes
Andre Menezes January 16, 2024

Hey @SheLa Newburn and @YogeshKR  any ideas why my JSON is not working?

 

{
"fields": {
"customfield_1234": {
"value": "Issue",
"child": {
"value": "Hardware"
}
}
}
}

0 votes
YogeshKR
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.
January 14, 2023

Hi @SheLa Newburn ,

Below JSON worked fine for me!
I copied a value from triggered issue. 

 

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

Hope this helps!!

Regards,
Yogesh

SheLa Newburn January 17, 2023

Thank you @YogeshKR

I tried it and interestingly enough, it no longer gives me and error but it still doesn't update the values in the field. I can see in the automations audit log that the rule even runs successfully, but nothing changes in the actual issue. Any thoughts as to why that may be?

Suggest an answer

Log in or Sign up to answer