Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner listener

Venkat Krishnamoorthy
Contributor
May 6, 2019

Hello,

I am trying to write a ScriptRunner listener that based on a change to a customfield on Issue XYZ, will have to run a JQL to identify an Issue on another project and then update a Customfield on that Issue. So far, everything I did is, based on an event, update fields on the same Issue.

BTW, Is there a way to incorporate REST API examples provided in SR for Jira Cloud in SR for Jira Server listener?

 

Thanks

Venkat

1 answer

1 accepted

0 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Champion
May 7, 2019

Hi Venkat,

Thank you for your question.

I can confirm that it is possible to return the issues that you want to update via JQL inside of ScriptRunner for Jira Cloud by calling the Search Rest API provided by Atlassian which is documented here.

You can then iterate over each issue provided by the result of the JQL search in order to update a custom field on that issue.

I can confirm that the Store Subtask Estimates in Parent issue on Issue events example located inside of the documentation located here provides an example of how to achieve this and can be used as a reference to create the script that you require.

I can confirm that for Jira Server that the same rest API's cannot be used as these are for Jira Cloud and that you should look to use the Java API which the server version provides to execute a JQL query as described here.  You will then need to use the Java API to update each issue returned by the JQL query.

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

Venkat Krishnamoorthy
Contributor
May 7, 2019

Thanks Kristian. I was able to incorporate JIRA Server JQL query example in my setup.

Suggest an answer

Log in or Sign up to answer