Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

compare logged in user to username in post function

Dan W
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 5, 2020

I am trying to compare the current logged in user during a post function to verify that the transition isn't running via an automation.  The automation is set to run as xyz user.  So if the user executing the transition matches that username I don't want to assign the current user to the assignee.  If the current user doesn't match the username then I want to assign the currently logged in user as the assignee.  This is what I have been trying unsuccessfully.  

 

import com.atlassian.jira.component.ComponentAccessor

def userManager = ComponentAccessor.getUserManager()
def issueService = ComponentAccessor.issueService
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser

if (user != userManager.getUserByName("xyz"))
{

def validateAssignResult = issueService.validateAssign(user,issue.id, user.username)
if(validateAssignResult.isValid()){ issueService.assign(user,validateAssignResult) }
}

 

I look at what the step in the post functions return when I run it manually and it appears to have the correct information but the assignee doesn't update.  I am new to Jira and Groovy so any help will be appreciated.

2 answers

0 votes
Oleg_Gerovich
February 26, 2014

Hi Nannette,

I'm not aware of good competitors, but take a look at https://answers.atlassian.com/questions/261657/gantt-chart-seems-to-throw-an-error. Frank released a new version of the plugin, which resolved the issue for us. Be aware that some functionality seems to have changed.

0 votes
Oleg_Gerovich
February 10, 2014

We had the same error appear on 02/20/2014 without making changes (as far as I know). We are using plugin version 3.0.0-JIRA6 with an evaluation license that expires on February 24, 2014.

Nannette Simpson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 26, 2014

I have several project owners who will be disappointed that we can't deploy a Gantt chart solution. Do you know of a competitor that I could eval?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events