Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Parameter name

Type

Required

Description

issue key

String

Yes

the key Key of the selected issue

user name

String

Yes

the user User name of the selected user

comment

String

Yes

the comment Comment that will be post posted on the selected issue

isPublicBooleanNo“true” for public comment or “false” for internal comment, the default is "true"
dispachEvent (deprecated)BooleanNo

“true” if you want to dispach the commentAdded event or and “false” if not, the default is "true".

Warning

In newer versions of Service Desk, the API responsible for this feature was deprecated, and Atlassian doesn't use this parameter in newer versions. Please don't use this property for this method.


...

The returned number represents the id of the comment. We decided to return this for future use or for third-party custom SIL routines.

Example

...

 

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 dispached.

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

Adds a public comment on the current issue,  on behalf of the current user. The commentAdded event will be dispached.

Same asThe same can also be achieved with the following script

Code Block
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 dispached.

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

Adds a comment on the current issue,  on behalf of the current user, viewable only by internal users. The commentAdded event will be dispached.

Same as:The same can also be achieved with the following script: 


Code Block
addJSDComment(key, currentUser(), "you can't see me", false, true); 
Note

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. Please donany more. Don't use this property for this method.

This means you should not be using the last attribute (, "true" ) in this example. Thus, your code should look like this:

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

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 dispached.

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

Adds a comment on the current issue,  on behalf of the current user, viewable only by internal users. The commentAdded event will not be dispached.

Note

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. Please donDon'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:

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

...