Send email to incident responders
Asked by mb:

Hi everyone,

Is it possible to send emails via automation to incident responders, e.g. when adding a service?

There's no such option in the "Send email" action, but I could imagine that it's possible to get the list of responders via api (webhook), save them to custom variables or similar and then send an email to them.

It would save me a lot of "if ... else" conditions and having to manage separate groups, just for email notifications regarding affected service queues.

Is there anybody who has achieved sending emails to responders via automation that might want to share their automation rule?

Thank you and Best Regards


Answers:
author: Jos? Nogueira
body: .


author: Bill Sheboy
body: Hi [@mb](/t5/user/viewprofilepage/user-id/4607957)

First thing: I am not using JSM and so my suggestions are based on what I know about rules, in general. With that out of the way...

I suspect the Responders field / information is a list of users / objects. In that case it can be iterated directly, if it is available to a rule.

So first try writing the Responders directly to the audit log to see what is returned.

If that works, try writing a specific item's contents to the log...or call the REST API for an incident to determine what responder attributes are available. This will determine if there is an emailAddress smart value available for use to the rule.

If instead the Responders are not a list, but instead either an array or delimited text, writing the value to the audit will identify what to use in a regular expression with the match() function to get the list of fields you want.

Kind regards,  
Bill


author: mb
body: So I worked on an automation and I used branching for some tests. I get the value of the custom field "responders" via log action and it returns me to following, which could be used to send the mail somehow:

Responders value is: {ari=ari:cloud:identity::user/\<PROFILEID\>, name=\<PUBLICUSERNAME\>, type=user, avatarUrl=<https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/M-4.png>}

So if I can somehow parse the "user/\<PROFILEID\>," by splitting the start by "/" and the end by ",", I would get the userid.

Then I could just mention the users in a comment by using "\[\~accountId:\<PROFILEID\>\]"

comments: author: mb
body: <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/>  
<https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split%28java.lang.String%29>  

This is the information I need to split the content of the "responders" field.


author: Jos? Nogueira
body: Hi [@mb](https://community.atlassian.com/t5/user/viewprofilepage/user-id/4607957)   

If I understand correctly, you have a custom field on which you want to split its content.

Based on the above and per my personal conclusion, it appears that split, replace, left, ... functions do not work for custom fields. One has to use a smart value variable in between.

+ info/sample: <https://community.atlassian.com/t5/Jira-questions/Re-Split-function-not-working-in-Jira-automation-for-a-c/qaq-p/2806242/comment-id/1049871#M1049871>

May I also share thiis source that I guess might help in your specific task  
<https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#left-int-length->

Hope this helps

Cheers


Tags: api

automation

cloud

email

incident

incident-management

jira-service-management

jira-service-management-cloud

opsgenie

webhook