Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Project Automation - Slack notification: how to tag users listed in custom field

Ashley Honeycutt
Contributor
October 20, 2023

I'm trying to integrate a conditional Slack notification in a specific channel. The goal is to have the notification mention each user listed in a multi-user field so they can get certain urgent notifications.

When I have the smart value in the notification, the automation fails with an error of "Error rendering smart-values when executing this rule." If remove this bit, the rule runs fine.

{{#}}@{{issue.approvers}}{{/}}

 Any advice on what I need to modify here is greatly appreciated. Thank you!

1 answer

1 accepted

3 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2023

Hi @Ashley Honeycutt 

When you want to iterate over a list of values in a rule, the syntax is like this:

{{#someList}}{{someFieldOfTheList}}{{/}}

For your case, are you trying to mention on the user's display names?  If so, that would be like this:

{{#issue.approvers}}@{{displayName}}{{^last}}, {{/}}{{/}}

That last handling adds a delimiter of ", " between values (leaving off the final one), so please change that as needed.

To learn more about list, smart values, please look here: https://confluence.atlassian.com/automation/jira-smart-values-lists-993924868.html

Kind regards,
Bill

Ashley Honeycutt
Contributor
October 20, 2023

Hi @Bill Sheboy

Thank you so much! Now we're getting somewhere. If I want the username to display instead, what would go there? 

The automation worked this time, however it didn't tag users on the Slack side (just the @FirstName LastName without a tag) so I think maybe we should try the username.

Mikael Sandberg
Community Champion
October 20, 2023

You have to use the display name or the member ID  that the user have in Slack for the @ mention to work. If all your users are using the default firstname.lastname as the display name then this should work for you:

{{#issue.approvers}}@{{displayName.replace(" ", ".").toLowerCase}}{{^last}}, {{/}}{{/}}

If some of your users have modified their display name in Slack then the only way you can @ mention them in automation is to use their member Id and the syntax for it would look like this:

<@memberId>

Like Bill Sheboy likes this
Hippolyte Simon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2024

Hi, 

I'm trying to create a rule that will mention in Slack all the participants to a meeting that are tagged as so in the issue. 

So currently what my rule does is that when someone creates an issue that is a Meeting it will send a message to Slack. 

At the moment in the message what works fine is: 

  • displaying the name and the URL of the issue
  • displaying the description of the issue
  • displaying the name of the reporter and mention them

What doesn't work is mentionning all the participants. Using the following formula:

{{#issue.approvers}}@{{displayName.replace(" ", ".").toLowerCase}}{{^last}}, {{/}}{{/}}

I made some progress and 9 names across 27 are correctly mentionned when tagging them as participants. The others are not mentionned. I tried to use <@memberId> but i didn't understood where did i had to integrate this part ot the whole above. 

 

Do you have any idea on how i could fix this? 

Thanks a lot for the help and have a great day! 

Hippolyte Simon

 

2024-05-21_17h55_11.png

Mikael Sandberg
Community Champion
May 21, 2024

Hi @Hippolyte Simon,

Welcome to Atlassian Community!

Slack no longer support @username so you have to use their member Id. Have a look at this article that describes how you can add users Slack member Id as properties on their accounts. 

Hippolyte Simon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 22, 2024

Hi thanks for your quick answer! 

A friend of mine and I found the solution, since i use this method to link Jira and Slack: https://community.atlassian.com/t5/Automation-articles/Mention-someone-directly-in-Slack-via-Jira-Automation/ba-p/1528605

Here's the formula: 

{{#issue.participants}}<@{{properties.metadata.slack_id}}>{{^last}}, {{/}}{{/}}

Thanks and have a great day! 

Hippolyte Simon

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events