I have a custom field (customfield_14543) with dropdown selections of Team 1, Team 2, Team 3, etc. When Team 1 is selected in the custom field, the automation will send a message to Team 1's slack channel.
When the custom field value changes (trigger) do I need to use Advanced Branching to send a slack message to that team?
@Sheri Seldes
No—Advanced Branching is not needed for this single-select dropdown use case in Jira Cloud; use a “Field value changed” trigger with an If/else block to route a “Send Slack message” action to the correct channel based on the selected team
Setup Steps
Dynamic channel mapping
Thanks
Jayesh R
Hi @Sheri Seldes -- Welcome to the Atlassian Community!
I recommend using a Lookup Table to map the field values to the Slack channel, and then use that in the rule action. This will make maintaining the rule easier. Please look here to learn more about lookup tables:
https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-lookup-table
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
I completely forgot about this action which is available in Jira Cloud :).
I think it is the best solution for this need
Thank for sharing this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! So the Key would be the Team name as it is reflected in the custom field and the Value is the slack channel?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, that is correct, @Sheri Seldes
For example, if your table was named varTeamToSlackChannel and customfield_14543 is a single-select option field, the result would be:
{{varTeamToSlackChannel.get(issue.customfield_14543.value)}}
I would also write that value to the audit log to help diagnose any problems in the rule later.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The look up table only allows alphanumeric characters as a value. Is there a workaround? The email and slack webhook have various characters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe a lookup table's value can contain any alphanumeric and symbol characters you are likely to use in the messages. You may need to use encoding for any JSON used in a message, such as with this function:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#jsonEncode--
I recommend trying it, and if you encounter errors, post what you tried and what you see in the log.
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.
Thanks for that image, @Sheri Seldes as it shows you are trying to add spaces to the table name. Unfortunately, that is a poor error message the editor shows; it would be better as:
Lookup table variable name can only be alphabetic characters.
Please try this for your table name, perhaps adding a prefix to reduce the chance of collision with existing smart values:
varWaitingOnLookupTable
Later, you may use that as below, based on your earlier fields:
{{varWaitingOnLookupTable.get(issue.customfield_14543.value)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Sheri Seldes
I don’t use Slack myself, but according to my research, it seems that Slack channels follow this format:
https://app.slack.com/client/(workspace_id)/(channel_id)
So it’s possible to use a dynamic value if your custom field stores the Slack channel ID and here the various : {{fieldChange.toString}}
eg : https://app.slack.com/client/(workspace_id)/{{fieldChange.toString}}
However, I think it’s not very user-friendly for Jira users to have to select a channel ID instead of a channel name.
Hope this helps
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.