Comments count field
This Scripted Number Field shows how many comments a work item has. Use it to spot busy work items in a list.
Applies to: Script Master for Jira Β· Cloud
The script asks Jira for zero comments, starting far past the end. Jira returns no comments but still reports the total, which is faster than loading every comment and counting them.
const response = await api.asApp().requestJira(route`/rest/api/3/issue/${payload.issue.id}/comment?startAt=9999&maxResults=0`, {
headers: { 'Accept': 'application/json' }
});
const data = await response.json();
return data.total ?? 0;
The app has the same script as the Number: Comments count snippet.
Relatedβ
- Write the field script: where to paste this script.
- Attachments count field: the same idea for attachments.
- Get comments: the Jira REST API this script calls.