I am trying to fetch email addresses of stakeholders field and use it to send email to them. However I could not find a way to do so.
Hello @Sidra Shakoor
This is not an area I'm very familiar with. Can you confirm for me that you are talking about the Stakeholders field in the Services that are listed under the Operations area for a JSM Cloud project?
Assuming I am looking at the same thing you are...
What I've learned so far:
If I use an API call like this to see all the fields in a JSM project where the Affected Services field has been set:
https://mysite.atlassian.net/rest/api/2/issue/TCSMC-1?expand=names
...I find that the Affected Services field corresponds to a custom field ID that stores information in the issue like this:
"customfield_10241": [
{
"id": "ari:cloud:graph::service/3754298e-7592-11ea-8733-0a77f3f45304/e93eaaa6-2d87-11ee-8c1d-0abe3f4a6601"
},
{
"id": "ari:cloud:graph::service/3754298e-7592-11ea-8733-0a77f3f45304/f0106fe6-da09-11f0-9fa7-122fa60ab53d"
}
],
So it doesn't seem like the Stakeholder field for the Service is directly available within the issue.
I found a couple of things that may be relevant:
https://jira.atlassian.com/browse/JSDCLOUD-9912
This is a suggestion to about revealing more information about Affected Services in the issue API. It includes a work around for getting the Service Name and Tier using the GraphQL API.
I also found that when I added a new Service that an Asset Object was created in a Asset Schema named Services.
If you can get the Service Name with the GraphQL API, then you could potentially use the Assets API to retrieve the underlying Object ID, and then use that to retrieve the Stakeholders attribute to get identifying information about the Stakeholder(s).
I haven't tried to actually work through this. At a glance it seems a bit complicated. Maybe somebody else has an easier way to get the information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sidra Shakoor ,
Yes, you can fetch stakeholder email addresses only if the Stakeholders field is an Assets (Object reference) field and the referenced object contains an Email attribute.
Jira cannot automatically read email addresses from a Stakeholders field unless the email is explicitly stored on the Assets object. If your object type (for example, Person or Employee) has an Email attribute, you can use it in automation like this:
{{issue.Stakeholders.Email}}
If the field allows multiple stakeholders, use:
{{issue.Stakeholders.Email.join(",")}}
If the Assets object does not have an Email attribute, it is not possible to fetch or send emails from the Stakeholders field. In that case, you must either add an Email attribute to the Assets schema or use a Jira User Picker field instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry I forgot to mention that I was referring to Services Object (Which is built-in). In that One can not add or delete any attribute. Is that possible to fetch email of the stakeholder in that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for clarifying. Since you’re referring to the built-in Services object in JSM (Operations/Services), the answer is no — it’s not possible to fetch stakeholder email addresses from it.
The built-in Services object is read-only. You can’t add, modify, or expose attributes like email addresses, and the Stakeholders linked to a Service are not available as user/email fields in Jira Automation or REST APIs.
Because of this limitation, Jira cannot fetch or use stakeholder emails from Services for notifications.
If emailing stakeholders is required, the only supported options are:
Maintain stakeholders as Assets Person/Employee objects with an Email attribute, or
Use Jira User Picker fields instead of Services
Unfortunately, with the built-in Services object alone, this isn’t supported today
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I assume that the stakeholders field in assets u are referring is an Attribute in objects in Assets.
If its a single people select use {{stakeholders.Email}} use the exact name u have named the attribute
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.
Sorry I forgot to mention that I was referring to Services Object (Which is built-in). In that One can not add or delete any attribute (That's the built-in fields too). Is that possible to fetch email of the stakeholder in that?
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.