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!
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?
Thanks for your answer. Yes, the question is saved to a Jira field, and yes, I want them posted as a comment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.