Hello,
I am hoping someone can help with me with the smart values needed to build an automation rule.
The automation rule will trigger when an issue is created. After going through a few issue fields condition, it will create a comment to be added to the issue.
The part that I need help with is I want text/links to display in the comment, but only when a certain field is selected in a multi-select field. For instance.
If Custom ID Field XXXXXX contains "Red" then display:
Red - www.red.com
If Custom ID Field XXXXXX contains "blue" then display:
There are too many different scenarios for me to build this into the automation rule itself so was hoping to accomplish it this way.
I have a similar rule set up but this ones only displays if the custom field is not empty
{{#if (issue.fields.customfield_XXXXXX.isNotEmpty()) }}
<b>Approval Conditions (Billing)</b>: {{issue.fields.customfield_XXXXXX}}
{{/}}
Can something similar be accomplished but instead of "is not empty", can it be "contains".
Any help you can provide is appreciated! Please let me know if you have any questions.
Hi @William Wightman ,
In order to read the value from and match it to a certain string/regex you need to use match() in the smart value.
Ref : https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--
A quick google search will give you plenty of examples of how to use the above, for your use case it should be something like this "issue.fields.customfield_XXXXXX.match("red")", if this is TRUE then the loop should run with the required output.
Do let me know if this works out for you.
@Jehan Bhathena Thank you for the quick response on this!
Unfortunately, I was not able to get this to work. I am fairly new to smart values and think I may be doing something wrong.
This is the error I am receiving:
This is how I set the comment in the rule:
{{#if (issue.fields.customfield_XXXXX.match("Red"))}}
The color is Red.
{{/}}
{{#if (issue.fields.customfield_XXXXX.match("Blue"))}}
The color is Blue.
{{/}}
{{#if (issue.fields.customfield_XXXXX.match("Green"))}}
The color is Green.
{{/}}
For the issue, I ensured that 2 selections were included in the custom field when testing.
Do you see anything quickly that may be incorrect?
Thank you!
William
Please note: I had to replace the actual names/text with colors due to our policies.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @William Wightman ,
The syntax for the custom field was incorrect (my bad)
Try using this : (customfield_XXXXX.match("Green")).
I would also suggest using the action "Log Action", and print the value that is stored in the above field eg.
{{customfield_xxxx.value}}
Reference : https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/#Testing-smart-values
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.