I'm using JMCF on both Cloud and DC.
On DC I have a field that gets the time stamp for the first comment.
Script is
issue.get("comment").find{!it.isInternal()}?.created
I cannot get this to work on Cloud. Please help. Thanks!
Hi @Marc Jason Mutuc
Yes, you can get a similar result in the cloud with the help of the code below.
Please try and let me know if it helps.
const createdAt = await api.issue.getField(issue, "comment");
let firstCommentDate = null;
if (createdAt && createdAt.comments && createdAt.comments.length > 0) {
for (const comment of createdAt.comments) {
if (comment.jsdPublic === true) {
firstCommentDate = comment.created;
break;
}
}
}
console.log("First comment created date where 'jsdPublic' true:", firstCommentDate);
return firstCommentDate;
Regards,
Neel
Thank Neel! It works on the field and when tested. But it does not get displayed via filters/issue navigator.
Also, any documentation you could point me to for these?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Apologies. I'm using a Scripted datetime field.
It's giving this error message when tested.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah. Just added
return firstCommentDate
Your code works. Thank you very much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
just as food for thought: Depending on your exact requirements, there may be apps available in the Atlassian Marketplace that can provide a simpler and more optimised solution for what you're looking for.
If you'd be open to this, you may want to have a look at the app that my team and I are working on, JXL for Jira.
JXL is a full-fledged spreadsheet/table view for your issues that allows viewing, inline-editing, sorting, and filtering by all your issue fields, much like you’d do in e.g. Excel or Google Sheets. It also comes with a number of so-called smart columns that aren’t natively available, including the date of the first external comment, and many other comment-related columns.
This is how it looks in action:
As you can see above, you can easily sort and filter by your comment columns; you can also use them across JXL's advanced features, such as support for (configurable) issue hierarchies, issue grouping by any issue field(s), sum-ups, or conditional formatting.
This all just works - there's no scripting or automation whatsoever required.
Any questions just let me know,
Best,
Hannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use a couple of customer fields and an automation.
I create a number field called "Time to First Response" and a Date Time field called "First Response Time".
Here is the automation I use.
Here is the Then: edit issue fields step.
Here is the And: edit issue fields step.
I hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline 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.