Hello there, we are using Jira Server and will be migrating to Data Center soon.
We have access to SIL scripts.
How can we achieve this requirement. I have very limited knowledge in Groovy/SIL. Does anyone have a sample script or a pre-existing template or similar for this requirement? It would help me.
Thanks,
Arun.
Hello Arun!
Indeed, it`s something we can do with SIL. I would even say that there may be few different approaches to configure that, but let`s consider one with SIL Listener.
The idea is to have SIL listener that will be triggered when issues are commented. In the script running on that event, we will check if the issue is in done status and for how long the ticket is in done status and if it`s less than 2 days the reopen transition is performed.
So, you need to configure SIL Listener that will be triggered by event "Issue Commeneted". Here you can find more information how to add SIL Listener
The script that is used for this Listener should be something like this:
string field_name = "status";
string[] field_history = fieldHistory(key, field_name);
number n = arraySize(field_history);
date startDate;
startDate = arrayGetElement(field_history, n - 2);
if (n > 0 and status =="Done" and ((currentDate() - startDate) <= "24h") ) {
autotransition("Reopen issue", key);
}
Please pay attention that status name "Done" and autotransition name "Reopen issue" should match names in your Jira and need to be replaced if those are different from my example. Also, if you have any conditions or validators on that transition, you may need to add extra parameters to the autotransition routine
autotransition(transition, issueKey [, skipConditions, skipValidators])
I am also adding documentation page about this autotransition routine
Hope it helps!
Anna
hey @Jeroen Poismans
we don't have Jira Automation in our server. hope we get it when we update the Jira.
@Anna Hryhoruk _Appfire_ , is it possible to run the script as the person who commented. because it would look neat, to reopen the ticket as the person who commented.
i used this script for something similar, and i also want to achieve a another similar thing. i'm doing a transition from 'Awaiting Response' to 'In Progress'. But the transition should be done by the ticket 'Assignee'.
your script definitely helped. just need these two modifications. any help would be great.
i could do something similar in SIL listener in the "if you want to run the script as a user, select one' but that seems to be just static.
thanks,
Arun.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Arun Chatterjee ,
Happy to hear that it was helpful!
yes, running this listener as a user who commented is possible. You need to add this single line to be the first line in your script:
runAs(argv[0]);
+ adding some documentation for this routine runAs
For the use case with the assignee, if the similar script is running as a Listener too, you can use a similar approach, just add to the beginning
runAs(assignee);
However, the script will not be executed if the issue is "Unassigned"
Hope this will provide you a solution for the use case. If yes, please do not forget to "Accept" the solution.
Best regards,
Anna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Clean.
This is now in production. Thanks for the help, Anna.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great! Glad to help :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
By the way, forgot to mention:
If you like Power Scripts app and have just a second to give us a shout-out on the Atlassian Marketplace that would be awesome
thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there and welcome to the community!
Not sure if you need a script for this. I think this could be achieved with automation:
The JQL should look something like this (might need to change a little bit:
status in (Resolved, Closed) AND ((status changed TO Resolved DURING (startOfDay(-2), startOfDay())) OR (status changed TO Closed DURING (startOfDay(-2), startOfDay())))
Good luck!
Regards,
Jeroen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.