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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
Highlighted

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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you