In Jira Cloud Automation, is there a way to CC an email to the rule owner?
Asked by Cash Coyne:

In Jira Automation, is there a way to CC an email to the rule owner?

In a rule, I want an email to be sent to the initiator, the assignee, AND the owner of the rule.

I know how to specify the Initiator and assignee. How do I specify the owner of the rule in the CC?


Answers:
author: Darryl Lee
body: There's always an API. It's just that some of them aren't documented (and probably not supported for what you're asking). Or you probably shouldn't bother (skip to the end of my post!) :-}

But heh it's fun to go digging. Turns out there is an API endpoint that would let you see the [JSON behind your rule](https://community.atlassian.com/t5/Automation-articles/Hacking-Parsing-Automation-Rules-with-JSON-for-Fun-and-Profit/ba-p/1984033), where you could get the **authorAccountId**:

```
 "authorAccountId": "123456:fffffff-ff11-ff11-11ff-ff11ff11ff11ff",
```

Here's the endpoint:

https://**YOURSITE** .atlassian.net/gateway/api/automation/internal-api/jira/**YOURSITEID** /pro/rest/GLOBAL/rule/**YOURRULEID**

Ok, **YOURSITE** should be pretty self-explanatory. And **YOURRULEID** is there in the URL when you are editing your rule.

The tricky part would be **YOURSITEID** . Probably the easiest way to find that is to Export your rule and look for the **ruleScope** where you will see something like:

```
 "ruleScope": {
   "resources": [
      "ari:cloud:jira::site/ffff1234-f123-12ff-ff1f-fffffffff"
   ]
 },
```

So yeah, IN THEORY you could use the good old [web request trick](https://community.atlassian.com/t5/Jira-Software-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828) to hit the API endpoint, and then get in the **authorAccountId.** BUT THEN you would have to make another web request to get the email, because there's now way to get that from a UserId ([thanks a LOT EU](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) :-P). Basically like this: [Populate a user picker field from the description field](https://community.atlassian.com/t5/Jira-Service-Management-articles/Populate-a-user-picker-field-from-the-description-field/ba-p/2134905?lightbox-message-images-2134905=216021i1FD550F46119B86D) except your URL would be

```
https://YOURSITE.atlassian.net/rest/api/2/user/search?accountId={{webResponse.body.accountAuthorID}}
```

BUT WAIT! How often is the Owner of your Rules changing? Why can't you just manually add/update them as Cc'ed users? I realize that's not very elegant. But trying to understand how often this happens. (Also you'd have to lookup the Rule ID for every rule where you do this, so again, that feels like way more work than just typing in the Owner's email.)

Or maybe you wanted this functionality to be generally available to all of your rules, or if you copy rules and assign different owners? In which case, yes, Bill's right about voting for [AUTO-76](https://jira.atlassian.com/browse/AUTO-76).

As always, probably more work than it's wroth to use the APIs for this, but always fun to explore a bit.

comments: author: Cash Coyne
body: You definitely did a deep dive!

I have a lot of rules and have me BCC'd on a lot of them, but if I want someone else to take them over, I'd have to change all the BCC's to that person.

What you propose may work, but it's more work than manually changing each rule's BCC, so I'll probably do that.

If I don't want to do that, I'll probably go with [@Nikola Perisic](/t5/user/viewprofilepage/user-id/5166624) 's suggestion and just create a group and BCC to the group.


author: Nikola Perisic
body: Hello [@Cash Coyne](/t5/user/viewprofilepage/user-id/4822720)

There isn't a direct way to get the rule owner. Also, there is no API that can fetch this data.

Workaround would be to create a group for example automation-rule-owners and put all of the users (if there are more admins) to be the part of this group then to CC them.

Otherwise, there is no other way.

comments: author: Bill Sheboy
body: Hi [@Cash Coyne](/t5/user/viewprofilepage/user-id/4822720)

That is not supported for rules yet, and here are two related suggestions you may want to watch / vote for. One specifically notes adding the ability to email rule owners with the Send Email action.

<https://jira.atlassian.com/browse/AUTO-76>

<https://jira.atlassian.com/browse/AUTO-109>

Kind regards,  
Bill


author: Cash Coyne
body: [@Nikola Perisic](/t5/user/viewprofilepage/user-id/5166624) , your solution is probably the most straight forward. Thanks.


Tags: cloud

jira