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

Send email when was assigned by automated rule

Daniela Buffarini May 8, 2021


Hello, could you support me with this use case? In my Jira instance, in the notification scheme, we have configured in Email Notification Preferenses send an email when "the issue is assigned to you" and this works ok, but when including a post function in workflow that automatically assigns the card, the person who has been assigned does not receive the mail. Can someone give me clarity why does this happen?

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Mohamed Adel
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.
May 8, 2021

Hi @Daniela Buffarini 

I think your problem with the order , Can you please check the order of your post-function and be sure that it is before firing  issue event

Daniela Buffarini May 10, 2021


Hi @Mohamed Adel OrderInPostFunction.PNG Thanks for your help, I add a screenshot to see the order; I understand that the execution rule that I automate happens first. In what order should it be executed so that it then executes the action of notifying the assigned users?

Mohamed Adel
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.
May 10, 2021

@Daniela Buffarini 

Now the problem is that you are trying to assign your issue but the fired issue event is Generic Event and this is not the one you configured your notification scheme for as you configured "Issue Assigned" Event , try to add your assignee script after firing the Generic Event and let's see how this work 

Daniela Buffarini May 10, 2021


Thanks again @Mohamed Adel . I followed your advice and changed the configuration in this way, but still the notification scheme did not send the mailOrderInPostFunction2.PNG

Mohamed Adel
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.
May 10, 2021

@Daniela Buffarini  good, now let's check your code how you are setting the assignee can you share your custom script 

Daniela Buffarini May 10, 2021

Yes.  This the code and assign the user correctly

OrderInPostFunction3.PNG

Text: 

import com.atlassian.jira.component.ComponentAccessor

def userManager = ComponentAccessor.userManager
def someUser = userManager.getUserByKey("xxxxxxx")
issue.assignee = someUser

Mohamed Adel
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.
May 10, 2021

ok , update your script to be like the one in this thread 

 

https://community.atlassian.com/t5/Jira-questions/Updating-assignee-via-scriptrunner/qaq-p/637155

 

import com.atlassian.jira.component.ComponentAccessor

def issueService = ComponentAccessor.getIssueService()
def userManager = ComponentAccessor.getUserManager()

def user = userManager.getUserByName("tbas")


def validateAssignResult = issueService.validateAssign(user, issue.id, issue.reporterId)
issueService.assign(user, validateAssignResult)
Like Daniela Buffarini likes this
Mohamed Adel
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.
May 10, 2021

also, move your assignee script order to be before the Generic event ,the ordering is not the issue now

Like Daniela Buffarini likes this
Daniela Buffarini May 10, 2021

OrderInPostFunction4.PNG
Now with this code I try again, but it does not make the change to assign the new user. Assigne remains unchanged. If it was Unassigned, it remains unchanged. Test in both circumstances, with the rule before General Events and with the rule after General Events with the same result. It does not update in assigne. I can not understand how to achieve the assignment and the sending of mail. Coud you keep helping me @Mohamed Adel 

Mohamed Adel
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.
May 10, 2021

@Daniela Buffarini  is there any error in the script history log?

Daniela Buffarini May 10, 2021

No. OrderInPostFunction5.PNG

 

OrderInPostFunction6.PNG

Daniela Buffarini May 10, 2021

OrderInPostFunction7.PNG


This is how notifications are configured for the project, just in case

Mohamed Adel
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.
May 10, 2021

What is the configuration on issue assigned event ?

Daniela Buffarini May 10, 2021

OrderInPostFunction8.PNG


It is exactly the same as generic event

TAGS
AUG Leaders

Atlassian Community Events