Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

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

Fazila Ashraf Community Leader 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

Yes. We are facing the exactly the same issue.

 

Any update?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

All you wanted to know about customer support KPIs

When working in customer support, it’s crucial to calculate, analyze and monitor specific numbers, called KPIs (Key Performance Indicators). They go hand-in-hand with customer satisfaction, problem d...

107 views 1 5
Read article

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