How to concat/join the parent and child values from a single cascade and copy to label field

Adam Dulberg April 3, 2023

I have two fields. First is a custom labels field. The Second is Select List (Cascading). I am trying to write an automation rule that when the 2nd field is edited, the values of the parent and child are combined via underscore to [fields or update either is fine] replace or add to what is in the first field. 

The situation may look like this:

Cascade: [Level 1] Profession [Level 2] Zookeeper

Custom Labels [null].

When the cascade is updated, I'd like the custom labels to display "Profession_Zookeeper".

I've read through every community post and Atlassian documentation. I've not been able to make this work using smart values as I can't figure out (if this is even possible) to nest the customfield_xxx.value and customfield_xxxx.child.value. As for the Json advanced editing, there's a lot of good info here about setting/copying to equal cascade fields (set), but I'm jammed up on combining the values to look like "parent_child". Be great if someone could lend a suggestion.

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
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.
April 3, 2023

Hi @Adam Dulberg 

First thing, I am using Jira Cloud, and not the Server/Data Center version.  With that disclaimer out of the way...

Have you tried just doing this with the concat() function to see what happens?  Perhaps like this:

{{issue.customfield_xxx.value.concat("_").concat(issue.customfield_xxxx.child.value)}}

Kind regards,
Bill

Adam Dulberg April 3, 2023

Yep that works thanks @Bill Sheboy

I was missing the second concat. Seems clear, I understand why it's necessary. Appreciate the quick turnaround.

Like Bill Sheboy likes this
SKAdmin May 3, 2023

Curious if anyone else has run into this problem when trying to feed 2 custom field values into a text field via automation.

{{issue.customfield_18601.value.concat("_").concat(issue.customfield_18602.value)}}

Edit Field - is Text Field (single line)

18601 - single select field

18602 - number field

Audit log comes back with no input

Adam Dulberg May 3, 2023

I'm sure someone more seasoned will chime in but wanted to eliminate the obvious. I'm assuming the rule status is coming back as "Success" yet nothing is happening or showing in the audit log.

First - Have you put a "re-fetch issue data" action after the edit and before the log audit action and properly defined what you are seeking in the audit log? 

Second - Fields 18601 and 18602 already have values and are not subject to being blank from race conditions or other situations; meaning they have values set before this automation trigger is set to run - correct?

SKAdmin May 3, 2023

Thank you for the quick response. 

I've also tried {{issue.customfield_18601.concat("_").concat(issue.customfield_18602)}} in the set value for field.

1) I do have the re-fetch. When I log each field individually I do get the values, but nothing shows up when I try to get the concat value

Value: {{issue.customfield_18601}} shows in the log as 1

Value: {{issue.customfield_18602}} shows in the log as Type1

2) Fields 18601 being updated is the When in this automation

Field 18602 could be blank, but shouldn't be

SKAdmin May 3, 2023

I think I solved my own problem. Didn't need concat. this works fine 

{{issue.customfield_18602}} - {{issue.customfield_18601}}

Adam Dulberg May 4, 2023

The concat is necessary when using a label field because Jira treats the space as a separate entry for an array. A text field accepts spaces as characters so there isn't the same consideration. In your initial post/reply you did say "Text Field" which I skipped over. If you change your approach to a label field, you cannot use your strategy and will need to refer to Bill's suggestion.

Suggest an answer

Log in or Sign up to answer