Skip to content

Instantly share code, notes, and snippets.

@nohtyp
Last active May 24, 2018 18:34
Show Gist options
  • Save nohtyp/9cfffcb720a72c741bf737bec3da3bcd to your computer and use it in GitHub Desktop.
Save nohtyp/9cfffcb720a72c741bf737bec3da3bcd to your computer and use it in GitHub Desktop.
Jira SIL code to get x comments from issue
// This is the name of the column "Latest comments SIL" code will need to be optimized (first sil script)
int lastnumOfComments = 3;
string [] allcmt;
number [] allCommentIds = getAllCommentIds(key);
int t = 0;
int arrsize;
int mcomments;
if (!isNull(allCommentIds)) {
if (size(allCommentIds) < lastnumOfComments){
return "Not enough comments";
}
else {
arrsize = size(allCommentIds);
mcomments = arrsize - lastnumOfComments;
if (mcomments == 0) {
for(number x in allCommentIds){
allcmt = allcmt + "\n---Comment---\n" + getCommentById(x).text;
}
return allcmt;
}
else {
for(number x in allCommentIds){
if (t >= mcomments and t <= arrsize){
allcmt = allcmt + "\n---Comment---\n" + getCommentById(x).text;
}
else {
t = t + 1;
}
}
return allcmt;
}
}
}
else {
return "No comments available";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment