I would like to be able to send an email when a user is added or removed from Project Role in a project in Jira Software Cloud.
In Jira Server I used Script Listener in Scriptrunner and there I could notify with email when a user was added/removed from Project Role while listening to 'ProjectRoleUpdatedEvent'.
I am looking for a way to get the same functionality in Jira Cloud.
I have looked into what is available in Scriptrunner (Script Listener), Webhooks and Jira Automation and have not found anything useful.
It seems to me that 'Project Updated' event is not triggered on role update.
Is there a way for me to use REST API or some event listnening to audit log?
I have not used REST API calls much so if someone could give me some idea how to start it would be much appreciated.
Hi Katrin,
I can confirm inside of ScriptRunner for Jira cloud that script listeners do not have a Project Role Updated event because Atlassian does not send a webhook event when an admin updates a project role.
This means the closest you can do is to have a listener script which runs on the Project Updated event.
However, you can call your script's Get Audit Records API to get the audit log records.
This means your script will start by fetching the audit log records, and I have an example that you can run on the script console here to see how to get the audit log records for reference.
In this example, if you uncomment line 12, it will return the audit log records for the updated project role action.
You can then check if this update happened in the project the listener ran for.
If it was you can then call the Send Notification API to send an email notification, and we have an example of calling this API in a script listener here for reference.
Using this information, you can write a script to solve your requirements.
I hope this information helps.
Regards,
Kristian
Hi Kristian,
Thank you for this, this helps a lot.
I'm going to try this out.
Best regards,
Katrín
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Katrin,
I am glad I was able to help you solve your requirements.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.