Recent searches


No recent searches

Add a comment to the ticket



Posted Jul 28, 2022

Hi, 
Is it possible to add comments using ZAF client? Tried to use:

client.invoke('comment.appendText', 'some text') 
client.set('comment.text', 'some text')

They both just add a text to the texfield but do not publish it.

0

2

2 comments

image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Andrei,

You'll want to use the client.request method to make an api call to accomplish this. 
 
Hope this helps!

0


You must use an API call. client.invoke or client.set both deal with the agent interface data - assignee, requester, fields values, etc but to update a ticket you must do like this :

client.get('ticket').then(function(response) {
  let ticket = response['ticket'];
  console.log(ticket['id']);
  client.request({
    url: '/api/v2/tickets/' + ticket['id'],
    contentType: "application/json",
    type: 'PUT',
    data: JSON.stringify({
      "ticket": {
        "comment": {
          "body": "Your comment goes here",
          "public": false
        }
      }
    })
  }).then(function(response) {
    console.log(response)
  })
});

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post