Portfolio: how to retrieve the current user's team

THIERRY ALEXANDRE March 11, 2021

Hi, 

We have several Teams working on the same project.

As a CurrentUser,

when creating a new issue,

then I would like the Portfolio's cfTeam  to be set to the Team I belong to.

 

So far I have been using a 'Custom Script Field' with the  following plugin to retrieve current Issue's Team's name :

import com.atlassian.jira.component.ComponentAccessor

import com.onresolve.scriptrunner.runner.customisers.WithPlugin

import com.onresolve.scriptrunner.runner.customisers.PluginModule

import com.atlassian.rm.teams.api.team.GeneralTeamService 

@WithPlugin("com.atlassian.teams")

@PluginModule GeneralTeamService teamService 

def customFieldManager = ComponentAccessor.customFieldManager

def cfTeam = customFieldManager.getCustomFieldObject(cfID// "Team" cfID = in your JIRA

if (cfTeam){

    String  cfTeamV = issue.getCustomFieldValue(cfTeam)

if (cfTeamV){

     CfTeamName = teamService.getTeam(cfTeamV.toInteger()).get().description.title

 

Is there a way I can use the same plugin to retrieve if CurrentUser() is assigned to a Team, and if yes what is the Team's name(s)?

Thanks for clues or solutions... 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer