Dear Community,
I am currently getting into Power Scripts and SIL, and I am trying to create a JQL function, which allows me to search for current updates on issues via comments. It would be very nice, if there was a possibility to create a custom JQL for Last Comment Date.
I found a similar question + solution for ScriptRunner in this post:
Do you have a recipe how I can solve this via Power Scripts?
Greetings Chris
Hi @Chris K – Amelie from the Power Scripts team here! @Mirek suggested a great solution above, using custom fields and setting up a listener.
You can also simply create the JQL using a SIL script:
comment_dateJQL.sil
string [] keys = selectIssues("project = " + argv[0] + " ");
string [] ret;
string format = "MM-dd-yyyy"; //format for date
for(string k in keys) {
JComment lastComment = getLastComment(k);
// runnerLog(lastComment);
// runnerLog(formatDate(lastComment.created, format));
if (formatDate(lastComment.created, format) == "" + argv[1] + "" ) {
ret += k;
}
}
return ret;
(The runnerLog is optional, in case you want to check the output)
argv 0 stands for project key, argv 1 for the search date of the comment (see screenshot attached)
Then you run the JQL search:
key in silJQLList("comment_dateJQL.sil", SPRN, 06-26-2023)
In our documentation, you can learn more about custom JQL Searches and the getLastComment.
Feel free to contact our support team, in case you have any future questions – they're Power Scripts experts and super responsive.
Best, Amelie
Thank you @Amelie Winkler _Appfire_ for confirming that my my thinking was also good :) I like the alternative solution that you proposed too!
@Chris K I think with both solutions you should be fine now :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Amelie Winkler _Appfire_ and @Mirek
Thank you for the solutions and the quick response.
At first sight, I prefer the "JQL-script solution", since I don't need to create a new custom field.
This case shows that there are "several ways to rome", I am very happy that you proposed a view :)
Take care and thanks a lot!
Greetings Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Chris K
I think there is an option to achieve it. There should be a getLastComment() function..
https://anovaapps.atlassian.net/wiki/spaces/SIL/pages/1828454/getLastComment
So in SIL Manager you should be able to view information about last comment for a specific issue. Example
string [] comment = getLastComment (ABC-1234);
runnerLog("Got comment:" + comment["date"]);
What you need is a date of this comment which you should now put in a Custom Field so that it could be searched..
So when you create a Date Picker custom field (you can call it as you want e.g Last Comment Date) you should be able to inject this to this field.
https://anovaapps.atlassian.net/wiki/spaces/PSJ/pages/1134133408/Custom+Fields+-+Setting+Values
Just make sure that you note the ID of the field since you need to put a date to it..
customfield_<yourCFIDhere> = comment["date"];
Now I guess you should be good and use SIL Listener to update the information
(As I see there is a event that is related to comments also such as "Issue Commented" so you should be good)
Hope it helps :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.