Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Update a custom field with the value found in a project role when the project role is updated


I am in the process of trying to come up with a way to create a listener that looks for a change in a specific project role and then goes into the custom field and updates the value to the value in the project role. 

Example is project role is called Project Manager. Someone edits the role and changes it from user a to user b, This triggers a script to take the users account id value for this project role and update a separate custom field called PM with that value for all tickets in that project.  


All tickets in a project will now have the PM custom field filled in with the value of user b instead of user a now.


Is this something that can be done with the Jira Cloud API? Any input would be wonderful.

1 answer

1 accepted

This can be achieved with Scripted Fields, instead of Script Listeners. There is no such event for listener to listen on.

To do that, navigate ScriptRunner > Scripted Fields:

1. Make appropriate configurations.

2. Under Field Type, choose "Text field".

3. Under Script to execute, use following snippet:

def projectKey = issue.fields.project.key

def roleDetails = get("/rest/api/3/project/$projectKey/roledetails")
.header('Content-Type', 'application/json')
.body as List<Map>

def adminRoleId = roleDetails.find({ == "Administrators"}).id //Replace with your role name

def roleActors = get("/rest/api/3/project/$projectKey/role/$adminRoleId")
.header('Content-Type', 'application/json')
.actors as List<Map>

return roleActors*.displayName.join(', ')

4. Once setup, when viewing issue, you might need to click on the ScriptRunner icon (under the issue description) for the scripted field to show for the first time.

Hope this helps!

@Max Lim _Adaptavist_,

Are you saying there are no events that fire when a project role gets a user or group added/removed to/from it?

I'm trying to do something based on when a group gets added to a role in a project under Users and roles (not the permission scheme).  If there are no events for this, that would be good to know so that I can try a different approach.

What about these events?  Do you know what they do?


I can ask in a separate question, but I thought this one was similar.  That is unless Alex is asking about adding a user to a permission scheme under a role.  Then that's different from what I need to do.

Never mind. :)

I read in another post just now that the ProjectRoleUpdatedEvent is the one that fires when adding/removing a user or group to/from a project role.

Suggest an answer

Log in or Sign up to answer

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