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

Cloud Scriptrunner Event Listener Comments Linked Issues

Hello Adaptavist and Community - 

I have a Cloud Service Desk project and 2 Cloud Core Projects, that looks like; A-> B -> C where A is the SD project, B is a core project and C is another core project. I have a post-function in A that creates a new issue into a desired project (user selects from a dropdown [B]) when the internal team responsible for the fix is identified. If the [B] project determines this issue should be routed to a different team, a transition is available to "move" the issue to project [C]. As [B] is moved through statusCategories, [A] similarly transitions and properly informs the customer.

The purpose of this is to allow a development team to function in their current workflow while addressing customer [internal stakeholder team] needs. We're using SD for the portal and SLA capabilities.

From the portal, a customer can make a comment and that comment shows on the issue view - that's the inherent function of SD [A]. However, through a specific link type "Cloners", I'd like any comment added to the portal to show up [B]. And through that same link type, comments to show up on [C]. 

My question, is it possible via Cloud products to create an event listener that posts a new comment through a specific link type, and persists the comments through that link relationship? I'd like when a comment is placed on portal [A], it would show up on [C] through the indirect relationship [linked via B].

I'm aware of the copy comments via post-function [JMWE Extension]; we have that implemented. But once an issue hits a given status "In Progress" and remains there, I'm struggling to figure out how to get comments to populate on linked issues. I've located where to find comments in a json blob and have run it through script console to show I can pull a given comment when I know what it is, but I'm struggling to identify how to script "grab me any new comment and post it on a linked issue of x type".

Sorry long post but description is necessary - thank you ahead.

1 answer

Hi Adam,

Thank you for your question.

I can confirm that to achieve your requirement with ScriptRunner for Jira Cloud that you would need to create a Script Listener which is configured to run on the Comment Created event.

I can confirm that this webhook event will then have the comment map structure as a property which will contain all the details of the comment as the Issue map as a property which will contain the issue key for the issue that the comment was added on. 

You will then be able to extract the comment text and issue key of the issue out of this map and save these to variables inside of your script.

Your script will then be able to get all the linked issues for the issue key you have extracted and from this will be able to make a rest call to post the comment on the Linked issue. 

If you need to get the linked issues of a linked issue then you will be able to do this by saving the issue key of the linked issue and then adding in another rest call to return its linked issues to add the comment on.

I can confirm that we have the example script here which shows how to get all the linked issues attached to an issue and to perform an action on them.

We also have the example script here which shows how to create a comment and you will be able to use these script examples as a reference guide to help yourself create the script that you require.

If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.



Hi Kristian thanks for your response. Its going to take me a few days to apply your info. I'll update if successful, and if not, I'll paste what I have.


Were you able to do this?

I actually got most of the way there, meant to reply months ago. Wasn't able to push this to the finish line - but I can see what Kristian is directing me towards. This time of year the same type of request rolls around so I'm probably going to have to complete this shortly.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

34 views 0 1
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