I recently stumbled over this Community Question:
https://community.atlassian.com/t5/Jira-questions/View-issues-that-have-been-moved-from-one-project-to-another/qaq-p/790346
I tried to run the Script, but it seams it would only work on Scriprunner for Jira Server
Since i am on Cloud and just starting to test Scriptrunner i wonder if somebody could help me get a working Script that gives me Issues that were moved from one specific Project to another specific Project for Scriptrunner Cloud.
Thanks
Best Wishes
Michael
Hi Michael,
Thank you for your question.
I have checked your requirement and can confirm it is not possible to use ScriptRunner for Jira Cloud to track the details of when a ticket is moved between issues and to post this information on an issue when it is moved.
The reason for this is that Atlassian does not provide a webhook that can be used to run code when an issue is moved using the built-in Move Issue functionality provided by Jira.
However, I can confirm that the closest thing you could do with ScritpRunner for Jira Cloud would be to configure a Script Listener which is configured to fire on the Issue Created event.
The listener code would then post a comment to the created issue with the original key of the issue so that you have this information documented on the issue when it is created and before it is moved to another project.
I can confirm that we have an example of how to add a comment on an issue when it is created inside of the documentation page located here.
You would then be able to search issues which have the comment added to see if the original issue key was from a different project.
I hope this helps.
Regards,
Kristian
Going forward you can configure a notification in the notification scheme for "issue moved".
Hallo Kristian,
i think you missunderstood my Usecase. I want to find out which Issues were moved from one specific Project to another specific Project. I don't want to change or Comment on the Issues and i want to do it in retrospect.
Is it not possible to access History Data from Issues in Scriptrunner Cloud? I didn't find Examples so far.
Thank you for your response.
I can confirm that it is possible to get the Change History for an issue by making a call to the Get Changelogs Rest API which Atlassian provides and is documented here.
Using this API you will be able to return the Change History from an Issue and you will be then able to write some logic check in the history returned if the issue has moved projects.
I have just created a small example located here which you can run on the script console in order to return the change history for an issue and you can use this as a reference guide to see how to use this API and to check in what in format the data is returned.
thanks for your Response.
Is there no other way, than to access all the Issues complete Changelogs?
def destProject = "AAA"def result = get("/rest/api/3/search?jql=project=${destProject}&fields=summary&expand=changelog").header('Content-Type', 'application/json').asObject(Map).body
And then check each if the Key was changed?
The next Problem would be the Paging of the Search.
The Example in https://community.atlassian.com/t5/Jira-questions/How-to-find-issues-that-were-moved-from-one-project-to-another/qaq-p/49115 uses a ChangeHistoryManager Class. is that or something similar not available in the Cloud Version?
Thanks for the Advice. I didn't think of that.
It looks like you're new here. Sign in or register to get started.