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.
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:-
2. Next, add the Post-Function as shown in the screenshot below:-
3. Next, from the Post-Function options available, select Custom script post-function [ScriptRunner]
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:-
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:-
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.