Delete a comment

Delete list comments or list item comments

swat.deleteComment

Deletes a Comment from a List or List item

Definition

swat.deleteComment(options, onSuccess, onError)

Example

Here's an example of how you can use this API to delete Comments of a specific List or List Item :

// Define the opts
let options = {
	comments: [{
      "lid":"list-id",
      "cid":"comment-id"
    }]
}

// Define success callback
let onSuccess = function(commentsObj) { 
  // Executed when list comments are successfully deleted
  console.log("Successfully deleted Comments from the List or List Item", commentsObj);
}

// Define error callback
let onError = function(error) {
  // Error is an xhrObject
  console.log("Error while deleting Comments from the List or List Item", error);
}

swat.deleteComment(options, onSuccess, onError);

API Parameters

ArgumentTypeDescription
optionsobjectoptions is an object with array of List Comment Delete Input
onSuccessfunctionCalled when the Comments are successfully deleted.
onErrorfunctionCalled when there is an error while deleting the Comments.

Success Response

The success response is an Array of Deleted Comments

{
  "d": [
    {
      "lid": "list id",
      "cid": "comment id"
    }
  ]
}

Other References

List Comment Delete Input

Object containing params required for deleting a comment

ArgumentTypeDescription
listCommentDeleteDef.lidstringList id of the comment
listCommentDeleteDef.cidstringComment id to be deleted

Deleted Comments

Fields in List Comment Response

{
  "cid": "System generated comment id",
  "lid": "List id for the comment",
  "txt": "Comment text",
  "via": "set as 'email' if comment received via email",
  "cby": "Created by email address",
  "uby": "Updated by email address",
  "cts": "Created at in milliseconds",
  "userinfo": {} // userinfo for the comment adder
}
ArgumentTypeRequiredDescription
cidstringYesComment id - system generated guid for the comment
lidstringYesList id - system generated guid for the list
viastringoptionalSet as email if comment was received via email, else undefined
txtstringYesComment content
cpropsobjectoptionalMap of custom fields
ctsnumberYesCreated time at in milliseconds
cbystringYesEmail address of the user who added the commentDefaults to 1. Quantity included for the action
userinfoobjectYesUser info of the comment adder
userinfo.emstringYesEmail address of the adder
userinfo.fnamestringYesFirst name of the adder
userinfo.lnamestringYesLast name of the adder