Hi all,
I have tried many workarounds for setting a notification to the assignee. Nothing worked so far.
Is there a script I can use in post function that updates, edits and fires a relevant event to notify the assignee.
My workflow is all complete but am struck at the notification part. Please help
According to JIRA API when issue is updated it is possible to define is it nessesary to send a notification.
Here is code for script postfunction (provided by SriptRunner plugin) to set assignee from custom filed:
import com.atlassian.jira.component.ComponentAccessor issue.setAssignee(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("fieldName").getValue(issue))
It should be executed before standard function "store to database"
Hi Vasiliy,
Thanks for the script. I will test it. Can you please help me in going one step further and set assignee based on another custom field's value in the script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vasiliy,
I have created a custom field eg: "user" and I used your script in the transition to update assignee to the custom field "user" but assignee did not change on that transition.
import com.atlassian.jira.component.ComponentAccessor
issue.setAssignee(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("fieldName").getValue(user))
I have included script at the very top, so that is the first action to take place
These are the transition steps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here you are:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.ApplicationUser import com.atlassian.jira.user.util.UserManager ApplicationUser userName = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("РФГ").getValue(issue) UserManager userManager = ComponentAccessor.getUserManager(); ApplicationUser assignee; switch(userName.getName()){ case "vzverev": assignee = userManager.getUserByName("name") default: assignee = userManager.getUserByName("default assignee") } issue.setAssignee(assignee.getDirectoryUser())
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I works on my JIRA instance. Do you run it from postfunction or from Script console?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used in post function
Post function --> Script post function–> Custom script post function
Did not work.
What is the field "name" value : vzverev or Vasiliy zverev (username or fullname )?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here should be username of user to assign to. For example vzverev or chubaka.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.