Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I need to modify the Assign to first member of role built-in script so that if there are no users is the said role it moves on to the next status in the workflow.
Regards,
Jenin C M
Ok, example.
Status A -> Transition to B -> Status B -> Transition to C -> Status C
You are talking about Transition to B. There is a postfunction "Assign to first member of role", lets say you configured role R.
If there is no member in role R, the issue "Transition to B" takes place without changing the assignee. The issue is in Status B.
I suspect "Move it to the next status" should mean Transition to C, correct?
In this case you have to add another script postfunction "Fast-track transition an issue" and add this condition to it.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.security.roles.ProjectRoleManager def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager) def projectRoleId = 10000 // ID of project role def role = projectRoleManager.getProjectRole(projectRoleId) def actors = projectRoleManager.getProjectRoleActors(role, issue.projectObject) !(actors.users)
Replace the projectRoleId with the ID of the corresponding role and choose the correct action for "Transition to C".
I think if you can get the source code of "Fast-track transition an issue" script and then modify it to check the roles. Do not start with "Assign to first member of role" script.
The reason is, "Fast-track transition an issue" script is the one that performs the required action. You need "Assign to first member of role" script only to understand how the validation (check the role members) should be done.
So start with "Fast-track transition an issue". Copy some code from "Assign to first member of role" into it. Good luck! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mmh. This is not a question.
If you want to modify a builtin script, you can copy the source (through the provided source link in the script) and save it with a modified name to the path (under WEB-INF/classes) according to the package of the script (which should not be changed).
This new script can now be adapted by you to your needs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mmh, I took a look into the script. If there is no user in a role nothing happens, only a warning message is logged to the log file. So the transition should happen.
Is that what you want? Or is "the next status" another transition after this transition?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Still not able to achieve it, its still going to transition B eventhough the condition is not met: I have added both post functions as given below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you add the Fast-track transition an issue postfunction after the fire event postfunction?
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.