It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
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! :)
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.
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?
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:
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.
Read moreHey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.