configuring Automation to trigger an email whenever the value of the Business Process Owner group and my Business Process Owner group type as a Group picker(single group) and i want to implmented thrght Script runner and i am using JIRA cloud For example: my taget status is Submitted and Business Process Owner group is it group so i want to send an email to it group peoples and my taget status is draft and Business Process Owner group is PSC review group so i want to send an email to PSC review group peoples
Hi @Pavan kumar MamidipakaThanks for the question.
If I understand your requirement correctly, you want to send an email to the members of the group selected in the Business Process Owner field whenever the issue transitions to a specific status.
If that's the case, could you let me know whether you're using Jira Automation only, or are you planning to use ScriptRunner as well? Also, is the Business Process Owner field a native Jira Group Picker or a ScriptRunner custom field?
The answer will determine whether this can be achieved using native automation or if you'll need to retrieve the group members through a scripted solution.
I want to implmented using Script runner but i am using the normal field
Dear @Pavan kumar MamidipakaI have tested the group lookup and notif flow in Jira Cloud and it worked.User this script.
def groupFieldId = "customfield_10064" // Change your actual field IDdef targetStatus = "Draft" // Change your target status
if (issue.fields.status.name != targetStatus) {return}
def groups = issue.fields[groupFieldId] as List
if (!groups) {logger.warn("No group selected.")return}
def users = []
groups.each { group ->def membersResp = get("/rest/api/3/group/member").queryString("groupId", group.groupId).asObject(Map)
membersResp.body.values.each { user ->if (user.active) {users << [accountId: user.accountId]}}}
users = users.unique { it.accountId }
if (!users) {logger.warn("No active users found in the selected group.")return}
def notifyBody = [subject : "Issue ${issue.key} requires your attention",textBody: "Issue ${issue.key} has transitioned to ${targetStatus}.",htmlBody: "Issue <b>${issue.key}</b> has transitioned to <b>${targetStatus}</b>.",to: [users: users]]
post("/rest/api/3/issue/${issue.key}/notify").header("Content-Type", "application/json").body(notifyBody).asString()
i want to implement Same code for each and every status right??
Hi @Pavan kumar Mamidipaka,
You don't actually need ScriptRunner for this. Native automation can send straight to a Jira group and every member of it gets the email. The one thing it won't do is turn your group-picker field's value into member addresses on its own: the email action's recipient dropdown (Send customized email) only takes static groups or user-picker fields, and a group-picker smart value returns the group's name, not emails.
Since you're dealing with a small fixed set of groups, branch on the field instead. Trigger on the status transition, then add an If/else block: if Business Process Owner is "IT Group", send with the recipient set to the IT Group; else if it's "PSC Review Group", send to that one. No per-status code to duplicate.
https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/
Hi @Pavan kumar Mamidipaka
Adding to what Gabriela sent, native Automation's Send email action cannot resolve a group-picker field to its members dynamically. You end up hardcoding each group in separate if/else branches, one per status and group combination.
Our app Notification Assistant for Jira takes a Group Picker custom field as a recipient directly. It fires only when your JQL or status condition matches. No per-group branches to maintain.
Feel free to reach out if you'd like to learn more.
It looks like you're new here. Sign in or register to get started.