Availability
- This routine is available starting with katl-commons 4.0.7.
- This routine is available for Jira server and cloud deployment options.
Syntax
deleteComment(commentId_or_mode [, issue])
New Parameter
Starting with sil engine 4.8.0.3, "dispatchEvent" parameter was added. It allows to trigger or not the issue comment deleted event. (Just for Server)
deleteComment(commentId, dispatchEvent)
or
deleteComment(mode, issue, dispatchEvent)
Description
Deletes a comment with the specified id, deletes the latest comment or deletes all comments from a given issue.Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
commentId_or_mode | Number or String | Yes | Either the comment id (if we use the routine with only one parameter) or one of the next, otherwise: |
issue key | String | No for Jira server Yes for Jira cloud | IssueKey. Should be used only if the mode is "DELETE_LATEST" or "DELETE_ALL" On the server version, the issue key parameter is optional, while on the cloud version it is mandatory and the order of the parameters should be as follows: (issueKey, commentId_or_mode) |
dispatchEvent | boolean | No | If set to false, the issue comment deleted event will not be triggered. Default value is true. This parameter is available just on the server version. |
Return type
Number
The number of comments deleted.
Example
Example 1
return deleteComment("DELETE_ALL", "TEST-1");
Deletes all comments from "TEST-1" and returns the number of comments deleted.
Example 2
return deleteComment("DELETE_ALL", "TEST-1", false);
Deletes all comments from "TEST-1" and returns the number of comments deleted. The issue comment deleted event will not be triggered.
Example 3
return deleteComment("DELETE_LATEST", "TEST-2");
Deletes the latest comment from "TEST-2" and returns "1" because only one comment was deleted. If the comment cannot be deleted it will return "0".
Example 4
return deleteComment(12400);
Deletes the comment with id 12400 and returns "1" because only one comment was deleted. If the comment cannot be deleted it will return "0".
Example 5
return deleteComment(12400, false);
Deletes the comment with id 12400 and returns "1" because only one comment was deleted. If the comment cannot be deleted it will return "0". The issue comment deleted event will not be triggered.
See also