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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,654
Community Members
 
Community Events
176
Community Groups

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

Atlassian Community Events