Cloud Scriptrunner Event Listener Comments Linked Issues

Adam Dulberg October 8, 2019

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

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 9, 2019

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.

Regards,

Kristian

Adam Dulberg October 10, 2019

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.

Ufuk Uysal July 30, 2020

hi,

Were you able to do this?

Adam Dulberg July 30, 2020

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
TAGS
AUG Leaders

Atlassian Community Events