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

Adding user to a project's role postfunction script works only if executed twice

Fazila Ashraf
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 16, 2019

Hi

I execute the below snippet in the transition postfunction as scriptrunner script to add the actor to the given project's user role.

 

ApplicationUser user = ComponentAccessor.getUserManager().getUserByKey("jira-admin-user")

ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(user)

def projectManager = ComponentAccessor.getProjectManager()
def projectRoleService = ComponentAccessor.getComponent(ProjectRoleService)
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)


def actors=[fazila]

def project = projectManager.getProjectObjByKey("JIRASUPPORT")

def projectRole = projectRoleManager.getProjectRole("Users")

def errorCollection = new SimpleErrorCollection()


projectRoleService.addActorsToProjectRole(actors,
projectRole,
project,
ProjectRoleActor.USER_ROLE_ACTOR_TYPE,
errorCollection)

log.debug "errorCollection" + errorCollection.toString()

 

It works well in the staging JIRA instance. But when i did the same in production, i have to execute the transition twice to actually get the user account added to the project's role.

The errorcollection is empty for both the execution and there are logs for both the transition execution. The code gets executed with out any error but the first time it just doesnt do the add user to project role action.

When i execute it in script console, once is actually enough.

What could be causing this in the JIRA instance? 

Thanks in advance for the help and insight!

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Prashant Mali
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 Leaders.
Sep 05, 2019

Yes. We are facing the exactly the same issue.

 

Any update?

TAGS
AUG Leaders

Atlassian Community Events