Hi everyone,
I do face a problem that I'm unable to resolve easily.
I have a release board that contains several custom fields, like f.e. PM - to indicate which Product Manager is involved in the release to certain client.
This field contains a Jira user selected from all company users that are using Jira.
Then I'd like to send a message to Slack (via webhook, to selected channel) to inform that the release has started (on issue transition from one status to another).
But... I'd like to mention the Slack user in the message to enable proper notification.
While doing it directly by returning the Jira field value - the field returns Jira ID - which is expected.
What I tried to do is to map the Jira account ID to Slack ID by introducing a new variable (f.e. slackPM) that is then called in the message as a smart value - see example below:
variable name -> slackPM
Smart value -> {{#if(issue.customfield_10216.accountId.equals("60630x2x0x6x3x00697XXX2e"))}}<@U01T8XXXX2X>{{/}}
The result is - that it's empty (no value is returned). I'm assuming that the custom field doesn't recognize the `accountId`.
How to do it properly to get the proper person (Slack user) being mentioned in the message like:
"Hello {{slackPM}}!
We’re happy to announce that a new release has just been started."?
If you have any different solutions that can achieve the goal I'll be happy to check them.
Many thanks in advance
Your solution is hard-codeded, not flexible.
I have two options as the potential solutions according to my previous experiences:
1.Maintain a Slack ID in jira user property
2.If the user emails are the same between Slack User and Jira User, we can use the email as the identifier between them, that is:
a) Get the email of a specific Jira User (customfield_10216)
b) Call slack API to get slack user id
c) Send Slack message to #channel with that user id
Hope it helps,
@YY Brother- Many thanks. I truly wanted to avoid API calls due to several restrictions we need fto follow. So I tried with less effort and resolved it on the Automation level only.
The fixed solution contains:
1. Use issue field condition on the custom field containing Jira IDs
2. Adding a variable that checks the Jira IDs and map those to Slack IDs
like:
{{#issue.customfield_x}} {{#if(accountId.equals("xxx:7b8265a8-xxxx-426f-a43b-xxxxxxxxx"))}}<@UXXX5XXXSA>{{/}} {{/}}
3. Sending Slack message with the created variable.
Works like charm :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great! It seems that you've just the countable PMs to notify thru Slack in your scenario. So hard-coding works like charm.👍🏻
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is your customfield_10216 field a user field? If so, is it single or multiple-selection? As you have written the smart value expression, that will only work for a single-select, user field.
Next, have you confirmed the custom field contains a value (i.e., a selected user), perhaps by writing it to the audit log when the rule runs?
Adding to the other suggestions, storing the Slack user ID as an entity property is often a better / less error-prone approach to solving this need than hardcoding the account ID values.
When you have many users for which to add the entity property, please try using this article from an Atlassian team member: https://community.atlassian.com/t5/Automation-articles/Mention-someone-directly-in-Slack-via-Jira-Automation/ba-p/1528605
That approach requires some technical / development skills. When you have only a few user IDs to add, a simpler approach is to use a separate automation rule to add the entity properties. The rule may be run one time and then disabled, and re-run when updates are needed to the Slack ID values. Please see this other question solution for those steps: https://community.atlassian.com/t5/Jira-questions/Re-Re-Iterate-through-JQL-result-of-issues-extract-cer/qaq-p/2916834/comment-id/1081211#M1081211
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.
@Bill Sheboy- Many thanks for your feedback. The field is multiple selection. I must admit that I wasn't aware that if the field will contain more than 1 value it won't work. Will definitely check the recommended sources.
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.