Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Send email when was assigned by automated rule


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

0 votes
Answer accepted
Mohamed Adel Community Leader May 08, 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


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 Community Leader 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 


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 Community Leader May 10, 2021

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

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

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 Community Leader 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

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 Community Leader May 10, 2021

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

OrderInPostFunction7.PNG


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

Mohamed Adel Community Leader May 10, 2021

What is the configuration on issue assigned event ?

OrderInPostFunction8.PNG


It is exactly the same as generic event

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

156 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you