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

Your Points Tracker
  • 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
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?
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

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

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!

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