addJSDComment

Description

Posts a comment on the specified issue on behalf of the specified user. Returns a number representing the id of the comment.

Parameters

Return Type

Number

The returned number represents the id of the comment.

Examples

Example 1

Use the following code to add a public comment to the current issue on behalf of the current user. The commentAdded event will be dispatched.

addJSDComment(key, currentUser(), "I have executed a transition.");

The same can also be achieved with the following script:

addJSDComment(key, currentUser(), "I have executed a transition.", true);

Example 2

Use the following code to add an internal comment to the current issue on behalf of the current user. The commentAdded event will be dispatched.

addJSDComment(key, currentUser(), "you can't see me", false);

The same can also be achieved with the following script:

Example 3

Use the following code to add an internal comment to the current issue on behalf of the current user. The commentAdded event will not be dispatched.

In the newer versions of Service Desk, the API responsible for the dispatchEvent attribute was deprecated, and Atlassian doesn't use this parameter in newer versions. Don't use this property for this method. This means you should not be using the last attribute, "false" in this example. Thus, your code should look like this:

See also