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

In a multiselect field, how do I use a smart value to test is a value is selected

Lukasz April 18, 2024

I have a form in my JSM project. The form has a question:

Question?

[ ] X

[ ] Y

[ ] Z

Now, I want to create an automation that will post a comment that will look differently depending on what options were selected. It would be something like... (pseudocode)

Hello {{requester.displayName}},

Thanks for raising this issue.

{{selected(Question?, X)}}Since your issue concerns X, we advise you to...{{/}}

{{selected(Question?, Y)}}Since your issue concerns Y, we will...{{/}}

{{selected(Question?, Z)}}Because you mentioned Z, the next steps are...{{/}}

Importantly, any combination of X, Y, Z is valid in the form, and each of the pieces of text should be generated (or not) independently of each other.

I'm trying to find documentation on how to use smart values to see if a particular value in multiselect field is selected, but https://support.atlassian.com/cloud-automation/docs/examples-of-using-smart-values-with-lists/ is not much help. Best I can think of is to convert all the selected values into a single concatenated string and then try to regex for each specific value with https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match-- but that seems really clunky. 

Is there a better way?

Thanks!

1 answer

0 votes
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.
April 19, 2024

Hi @Lukasz 

is the answer to the question saved into a Jira Field? If it's only part of a form, you're more or less out of luck or at least have to fiddle with the forms API which isn't that far developed yet.

I would therefore suggest creating a Multiselect List Custom field (if not done yet) so you can easily access the result in an automation rule.

Where do you want the texts populated? You want it posted as a comment?

Lukasz April 23, 2024

Hi @Rebekka Heilmann _viadee_ 

Thanks for your answer. Yes, the question is saved to a Jira field, and yes, I want them posted as a comment.

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.
April 24, 2024

In that case, you can simply use the issue fields condition and don't need a smart value.

You can check for selected values in Multiselect fields: is one of... equals.... is empty... etc.

You need to create a lookup table where you manage your comment texts. Then create 3 variables for each condition and set a value from the lookup table. You then concat these in the comment: {{varA}} {{varB}} {{varC}}

That might give you some unwanted spaces but not sure if there is a nicer solution to concat Strings over multiple conditions.

Note: I couldn't test the rule below, as I ran out of rule executions on my test site.

Screenshot 2024-04-24 102201.png

Screenshot 2024-04-24 102309.pngScreenshot 2024-04-24 102322.png

Suggest an answer

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

Atlassian Community Events