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,552,108
Community Members
 
Community Events
184
Community Groups

Workflow transition assignee by project admins

I found this functionality extremely anticipated for my teams. I hope it helps you too :)

Firstly: what was the issue?

1) Needed flexibility with setting assignees when issues are moved to following statuses.

2) Assignees should be project specific.

3) Project administrators should be able to change the assignees.

What you need?

Two Jira plugins: ScriptRunner and Enhenced Project Properties

I do recommend to load following script to Jira server as it will be commonly used:

/***********************************************************************************/

import org.apache.log4j.Logger
import org.apache.log4j.Level
Logger log = Logger.getLogger("workflowTransitionAssignee.groovy")
log.setLevel(Level.DEBUG)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser

String transientName = transientVars.getAt("descriptor").getAction(transientVars['actionId']).name
String propertyKey = "workflow.transition."+transientName+".assignee"

def pluginAccessor = ComponentAccessor.getPluginAccessor()
def projectPropertiesManager = null
try{
projectPropertiesManager = ComponentAccessor.getOSGiComponentInstanceOfType(pluginAccessor
.getClassLoader().findClass("com.tse.jira.projectproperties.plugin.api.ProjectPropertiesAOMgr"))
}catch(Exception e){
log.error("Enhanced Project Properties plugin (https://marketplace.atlassian.com/apps/1217709/enhanced-project-properties) not found in the instance")
return
}

def propertyComponent = projectPropertiesManager.getProjectPropertyByKey(issue.projectObject, propertyKey)
if(propertyComponent == null){
log.debug(propertyKey + " property key not found")
return
}else if(propertyComponent.propertyValue == null || propertyComponent.propertyValue.trim() == ""){
log.info("Value for property key "+propertyKey+" is null or empty")
return
}else{
log.debug("Property for " + propertyKey + " : " + propertyComponent.propertyValue)
}

ApplicationUser user = ComponentAccessor.userManager.getUserByName(propertyComponent.propertyValue)
if(user == null){
log.warn("User " + propertyComponent.propertyValue + " not found in the system")
return
}

issue.assignee = user

/***********************************************************************************/

Add the script to each transition where you want to have the functionality available. Remember the transition name!

Set project properties like:

workflow.transition.Create.assignee = dave
workflow.transition.In Progres.assignee = hubert

You can also modify Project Permissions scheme so Administrators can manage Project Properties and it's visible to Developers.

Disadvantage:

Project administrators have to use user names.

0 comments

Comment

Log in or Sign up to comment