Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Email post function

Garden16_ November 6, 2023

I would like to send out a email to team lead and PM  when ever there is a big assigned to one of the development  team members . 

I created a post function for the assigned defect work flow . 

 

I want the condition where the defect type is Bug and the status is assigned defect  issue.issueType.name == 'Bug' & issue.status=='Assigned Defect'

email template to 

which tell that defect is assigned to memeber of your team : asssigneee name 

 

this post function needs to trigger and send email only when the defect is assgigned to member of dev team 

 

How do i achieve this using post function 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Muhammad Moazzam Hassan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 6, 2023

This can not be achieved by using the post function because it triggers on issue transition and your trigger is based on issue type and assignee which can only be done via Automation Rule.

if you want to do it via the post function then you have to add the specific transition for it and have to validate the assignee and issue type via validator so the transition can only be used as per your condition.

Garden16_ November 7, 2023

assign defect transition.PNG

Garden16_ November 7, 2023

I have added the post function when the defect  is assigned.

Any time this transition occurs, I would like the email to go to 3other people in the team besides the assignee.

Zaldy Parian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 9, 2023

Hi @Garden16_ 

Can I please ask, how did you manage to get the Send a custom email in Post Function?
I checked in my workflow, and I could not find it from the list of functions...

post_function.png

Muhammad Moazzam Hassan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 9, 2023

Hi @Garden16_ ,

Now you can trigger a custom event from which you can send email or you can use automation rule to send email, but for automation rule it must have to find on which transition you want to send so for that on this transition you have to update one more field so on that field basis you can send email.

Garden16_ November 13, 2023

 Added email  using script runPostfunction.PNGner 

Like Muhammad Moazzam Hassan likes this
Muhammad Moazzam Hassan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2023

This is good.

Zaldy Parian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2023

Hi @Garden16_ ,

Could you please share the steps to add a post function from ScriptRunner?

Garden16_ November 14, 2023

click on the transition and select post function and select the radio button for sending custom email. Click add and  add the below for functionality

condition : 

issue.issueType.name == 'Bug'
Email template : 
Hello,

Defect ${issue.key} has been assigned to ${issue.assignee?.displayName}
 
Defect Summary:$issue.summary

<% if (mostRecentComment)
    out << "Last comment: " << mostRecentComment
%>
subject template 
The Defect $issue is now in Assigned status
Zaldy Parian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2023

Thanks. We could have different instance of Jira. We are using Jira Service Management (JSM) Cloud instance. And I don't see any option for sending email under post function tab.  This is what is available to me, there no option to send custom email...

post_function1.png

TAGS
AUG Leaders

Atlassian Community Events