How can I use string funktions with a smart value as source?

MARCO EBERHARD February 27, 2024

I have a User defined field "Select list (multiple choices)"

The options are structured as "Optiontext 1 #01", "Optiontext 2 #02"...

In the automation, i have to sum all selected option values. So, I do a branching and get a smart-value {{Var}} for all entries.

Within the branch loop, I want to extract the number of the selection into another smartvalue. I tried:

{{Var.right(2)}}

{{Var.split("#").second}}

The result is empty.

 

1 answer

1 accepted

0 votes
Answer accepted
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2024

Hi Marco - Welcome to the Atlassian Community!

Can you share a screenshot of your whole rule? 

MARCO EBERHARD February 28, 2024

Upload is not possible, I get an upload error for jpg and png (35 kB).

Script 

-----

Trigger

          Branch "for all: Smart-Value"    --> this works

          Copy Branch-Variable into another variable --> this works

          Split copied variable into a third variable --> this does not work, Variable is empty

          Send email with all values

-----

Split is done: either {{Var.right(2)}} or {{Var.split("#").second}}

I get the right number of emails.

Content is:

Var1: Option #01
Var2: Option #01
Var3: {Empty} (Always)

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.
February 28, 2024

Hi @MARCO EBERHARD 

Adding to John's answer:

Without seeing the exact smart value expressions you are using for the branch and the variables, and your entire rule, it will be difficult to diagnose what you describe.  Providing this information is essential when asking for help with automation rules.

 

If you are only trying to sum those numbers which are part of the option names, that could be done without a branch like this:

{{#=}}0{{#issue.myMultiselectCustomField}}+ {{value.substringAfter("#")}}{{/}}{{/}}

This will iterate over the selected values, extracting the numbers to add them to the total, with an overall default value of 0 on the left side.

 

Kind regards,
Bill

Like John Funk likes this
MARCO EBERHARD February 29, 2024

Hello @Bill Sheboy 

This works perfect. 

Thanks a lot and best regards

Marco

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events