editComment

Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center? Click here !

Availability

  • This routine is available starting with katl-commons 3.0.10.
  • This routine is available for Jira server and cloud deployment options.

Syntax

editComment(commentId, comment)

or

editComment(commentId, comment, securityLevel)


New Parameter

Starting with sil engine 4.8.0.3, "dispatchEvent" parameter was added. It allows to trigger or not the issue commented event. (Just for server)


editComment(commentId, comment, dispatchEvent)


or


editComment(commentId, comment, securityLevel, dispatchEvent)


Description

Edits a comment with the specified id and text. Optional, you can edit the security level for comment. Returns the comment representation after the edit.

Parameters

Parameter name

Type

Required

Description

issueKeyStringYes for Cloud

The key of the issue.

On the server version, the issue key parameter doesn't exist, while on the cloud version it is mandatory, and the order of the parameters should be as follows:
Cloud: (issueKey, comment_id, comment[, securityLevel])

commentId

number

Yes

Id of the issue comment.

comment

String

Yes

Text that will be post on the selected comment.

securityLevelStringNo

Security level of comment.

On the server version, the securityLevel can be a group or a role. On the cloud version, only project roles are accepted.

dispatchEventbooleanNo

If set to false, the issue comment edited event will not be triggered. Default value is true.

This parameter is available just on the server version.

Return type

JComment

The comment representation with the following keys:

Key name

Description

id

Id of the issue comment.

textComment text.
authorAuthor of the comment.
createdCreation date, as string, can be assigned to a date variable.
updatedByUpdater, or empty string if there is no updater.
updatedUpdated date, or empty string if there's no update.


Example

Example 1

string newComm = "This comment was edited.";
return editComment(11801, newComm);

Edits the comment with id 11801 with the specified text .


Example 2

string newComm = "This comment was edited.";
return editComment(11801, newComm, false);

Edits the comment with id 11801 with the specified text, the issue comment edited event will not be triggered.

Example 3

JComment jcomment = getCommentById(11801); 
string oldComm = jcomment["text"];
string newComm = oldComm + "\nEditing the comment";
return editComment(11801, newComm, "Developers");

Edits a comment by adding new text to the old one and that can be viewed only by "Developers".

See also