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

Branch over Smart Value List only executes once

Rebekka Heilmann (viadee)
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2024

I want to branch over a list of values, in the specific case it is the "Affected Services" field (JSM specific).

For my test, the field contains 3 Values and the Log Action returns: "ServiceA, ServiceB, ServiceC". However, the branch only executes once and the Variable contains the whole list rather than only one value at a time.

My understanding was, that the Branch rule would be like a for each. So for every value in a field, I can execute actions. Therefore, i would have expected the Variable to return "ServiceA" for the first iteration, "ServiceB" for the 2nd and so forth. That doesn't seem to be the case. 

Question: Is is a bug or a feature? What am I missing here?

Screenshot 2024-01-15 164803.png

1 answer

1 accepted

2 votes
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.
January 15, 2024

Hi @Rebekka Heilmann (viadee) 

What is the type of your custom field: text, multiple select, something else?

Some field types need to use the split() function to turn them into a list for processing by the branch.  For example:

  • a text field containing: A,B,C
  • would need to be split with this to be used: {{issue.myCustomField.split(",")}}

Kind regards,
Bill

Rebekka Heilmann (viadee)
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2024

Hi @Bill Sheboy 

It's not a custom field. Affected Services is a System field that is connected to the "Services" Feature from JSM.

Screenshot 2024-01-15 171115.png

If I change it to {{issue.Affected services.split(",")}} it doesn't return anything at all.

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.
January 15, 2024

That is curious that the type is unknown.  I am not using JSM, and so I wonder if this is a dynamic field, calculated just-in-time for usage, which then prevents use in the branch.

The way to check this (and solve your scenario need) is this:

  • using the Create Variable action, save the field value, which will make it text
    • variable name: varAffectedServices
    • Smart value: {{issue.Affected services}}
  • write that to the audit log to confirm it contains what you expect, and adjusting the delimiter for the split() as needed
  • now branch over that value like this:
    • {{varAffectedServices.split(",")}}
Rebekka Heilmann (viadee)
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2024

It worked now.

I used {{issue.Affected Services.name.split(",")}}

No need for a variable - that was a Layer 8 problem ;) - I didn't know that Automation appends Log messages into one output if there is no action in between.

Now I just need to figure out how to copy the the corresponding Affected Service to each Sub-Task ;) 

Like Bill Sheboy likes this
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.
January 15, 2024

Well done!  

They were objects, similar to iterating over users.  Once you have the object, the different attributes need to be accessed.

This how-to article can help when using smart values like this, as it shows the structure and smart values in the issue: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events