Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Need the grp email trigger when status is changed

Garden16_ July 10, 2023

I would like to send email notification to deployment team (grp) via a grp email when ever the issue status is changed to 'Ready for Build' I am using this status when the Bug is fixed or when the task is competed and is ready for build . How do I  send grp email notification when this event (status change) event is triggered. Please advise.

I have script runner  tool ..how can I leverage this tool for achieving this.

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 26, 2023

Hi @Garden16_

For your requirement, I recommend using ScriptRunner's Custom Script Post-Function. Below are the steps you need to follow:-

1. Select the transition to which you want to which you want to add the Post-Function. Once the page is loaded, select the Post-Function tab as shown in the screenshot below:-

image1.png

2. Next, add the Post-Function as shown in the screenshot below:-

image2.png

3. Next, from the Post-Function options available, select Custom script post-function [ScriptRunner]

image3.png

Once you have Selected the Custom script post-function, you can add the sample working script below:-

import com.adaptavist.hapi.jira.groups.Groups
import com.adaptavist.hapi.jira.mail.Mail
import com.adaptavist.hapi.jira.users.Users
import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.groupManager
def jira_admin = Groups.getByName('jira-administrators') //Modify Group Name

def jira_administrators = groupManager.getUserNamesInGroup(jira_admin)
def emailAddresses = jira_administrators.each {Users.getByName(it).emailAddress } as String[]

Mail.send {
setTo(emailAddresses)
setSubject('Test') // Modify Subject according to your requirement
setHtml()
setBody('This is a test mail') // Modify email body according to your requirement
}

Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.

You must modify the group name shown in the Comment Line in the code above. You must modify the group name, email subject and body as shown in the Comment Line in the code above.

Below is a screenshot of the Post-Function configuration:-

image4.png

Once you have added the code, Publish the changes made to the workflow for the Post-Function to take effect.

Below is the email output that is received:-

test1.png

I hope this helps to solve your question. :-)

Thank you and Kind regards,

Ram

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events