Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,747
Community Members
 
Community Events
184
Community Groups

Using Automations to ADD a Label derived from multiple Custom Field values

I am attempting to use automation to ADD a dynamic Label derived from two custom fields.

  • I want to apply a label that is a concatenation of a string and two custom fields' values like:
    • "string-{{cf1_Value}}-{{cf2_Value}}"
  • the idea is that cf1 and cf2 will change over the life of the issue
    • cf1 is a string (from a dropdown) and cf2 is a number
    • when certain conditions are met, I want to apply a label to "capture" that the issue achieved that particular status

 

The automation currently is attempting to do the folllowing:

  1. When: Issue updated
  2. IF:matches
    1. cf1_Value = "someString"
      1. Then: transition the issue to paused
      2. And: Edit issue fields
        1. cf2_Value = {{#increment}}{{issue.cf2_Value}}{{/}}
        2. Labels =
          1. (ADD) "string1", "string2-{{issue.cf1_Value}}-{{issue.cf2_Value}}"*
          2. (REMOVE) [none]

*Note:

  • I can't replicate the exact syntax here
  • "string1" in the label update is a static string/label
  • the second label, "string-{{cf1_Value}}-{{cf2_Value}}", is the dynamically derived label just in case my syntax is not clear.

 

  • I've also attempted to use
    • json/more options via the "Edit issue fields" - for example:

{

     "update": {

          "labels": [{

               "add": "string1"    

                    },

                    {

               "add": "string2-{{issue.cf1_Value}}-{{issue.cf2_Value}}"

                    }]
     },
}


The cf1_Value is the display name of the custom field vs. the ID (cf#####) format.

 

I feel like one of these options should enable this operation but so far, I've not been able to crack the nut.   Anyone have a solution for this challenge?  Thanks!

1 answer

1 accepted

2 votes
Answer accepted
JM Perrot
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.
May 17, 2023

Hello @Doug Winenger 

Did you try it with variables like

vparent = {{issue.cf_XXXX.value}}

vchild = {{issue.cf_XXX.child.value}}

vlabel = {{vparent.concat(vchild)}}

and set your label with {{vlabel}}

Thanks @JM Perrot 

I'm trying to concatenate 5 different values (vs. 2):

  1. "string1"
  2. "-"
  3. cf1_Value
  4. "-"
  5. cf2_Value

Using the method you describe, I'd have to do a series of variables to build out my string using concat() based on what I'm seeing.  That probably will work.  I'm just thinking there's got to be a more efficient way to build the final string I need for the label.

In any case, I've tried the initial steps of your idea.  So far, my variables are not set with my custom field values. I've tried variations of the syntax below attempting to set my "vparent" value from the field's value.

I've tried:

  • {{issue.cf_22190.value}}
  • {{issue.cf_22190}}

Each time, my automation "Succeeds" but I have no value in my variable in the audit log.  Note, i've tried this with two different custom fields as one is a number and the other is a dropdown/string.  I get the same result (null value) each time.

 

Greenshot 2023-05-17 22.29.07.png

JM Perrot
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.
May 18, 2023

Hey, it's normal, the syntax is not correct, sorry I wrote an abbreviation 

the correct smart value is : {{issue.customfield_22190.value}} for the parent value and {{issue.customfield_22190.child.value}} for the children.

If you have just a simple custom field (not a cascading list) you can just write {{issue.customfield_XXXXX}}

Like Doug Winenger likes this

okay, that syntax worked on my first field...thank you. I've read so many articles and questions...finding the correct syntax is a bit of an adventure...  

I'm working on the logic to see if I can use this to get to my final label/string now...will update here if I get it to work :)

 

okay, happy to report that this process is working :)

I am currently creating and concatenating 8 variables in a sequence to get my final output.

I'm working through a final issue where my prior/dependent automations' label is not being applied or is being removed somehow...(now fixed - working 100% as expected)

For anyone that finds this and wants to know how it works, here's the process and syntax I used based on JM's suggestion:

  1. when: value changes for [insert fields in question]
  2. if: matches
    1. field = someValue
  3. Then: create variables
    1. cf1_value = {{issue.customfield_22190}}
    2. cf2_value = {{issue.customfield_22192}}
    3. string1 = lr 
    4. delimiter = -
    5. labelOne = {{string1.concat(delimiter)}}
    6. labelTwo = {{labelOne.concat(cf2_value)}}
    7. labelThree = {{labelTwo.concat(delimiter)}}
    8. labelFour = {{labelThree.concat(cf1_value)}}

My result is a string:

"lr-cf2_value-cf1_value"

I then used the {{labelFour}} smart value to ADD the label via the Edit Issue fields component.

Like Kelly Arrey likes this
Kelly Arrey
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.
May 26, 2023

Glad this is working!

As an aside, the Log action is very handy for debugging stuff like the above.2023-05-26_09h48_58.png

Suggest an answer

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

Atlassian Community Events