Issue in update button event

I found the below issues while updating a ticket’s properties (ticket.propertiesUpdated):

  1. without updating any ticket property by default priority coming in the event payload
  2. if I update the date with the time field(custom field), a date is not coming, only time can see in value in the event payload

Please let me know to overcom this as I am developing one custom app having above block iteams

Thanks,
Tejasri

1 Like

Hi Team,

As this high priority requirement. did ant get a chance to look into this?

Hi @Tejasri_Kalluri

I tried reproducing your requirements with following code,

document.onreadystatechange = function () {
  if (document.readyState === 'interactive') renderApp();

  function renderApp() {
    var onInit = app.initialized();

    onInit.then(getClient).catch(handleErr);

    function getClient(_client) {
      window.client = _client;
      client.events.on('app.activated', onAppActivate);
    }
  }
};

function onAppActivate() {
  var textElement = document.getElementById('apptext');
  var getContact = client.data.get('contact');
  getContact.then(showContact).catch(handleErr);

  client.events.on('ticket.propertiesUpdated', function getPayloadonUpdate(event) {
    console.log(event.type + ' event occurred');
    var event_data = event.helper.getData();
    console.log('eventdata', event_data);
  });

  function showContact(payload) {
    textElement.innerHTML = `Ticket created by ${payload.contact.name}`;
  }
}

function handleErr(err) {
  console.error(`Error occured. Details:`, err);
}

With this sample I tried to do two things

  1. I saw if getPayloadonUpdate(..) being triggered without hitting the update button in :freshservice: I could see the event_data only when user clicks the update button.
  2. I created a custom field that reflects date. In this case, what you reported is accurate.

I get following event data:
image

I can see date custom field’s value doesn’t have DD-MM-YYYY associated with it.

For #1, can you share an example code that can help me reproduce event payload triggered even if ticket property is not updated as you claim?

Thanks for the clarification @Saif for 2nd point, is there any solution to get the full date and time format?

I will send you a video grab for that I have used the same payload code you used here

Hi @Saif Sorry for being late here is the take-off video for 1st point mentioned

if you can see without updating a field can see in update event payload priority as default value in the payload

I have used same event u used here

Video Take: Issue with updating a ticket using update button without field update?

Thanks for the details. I’m still trying to follow up with the FS team. Please allow me a day or two further.

1 Like

Just a follow-up to acknowledge you that I still haven’t received any update from the :freshservice: team.

@Tejasri_Kalluri - From the video I can understand the following:

  1. The ticket had priority ‘High’ by default.
  2. User clicks on “update”
  3. You receive the “High” priority in the payload.

In case, if the user changes to “Low” and clicks on “update” the payload should expect to have “Low” in the argument passed to getPayloadonUpdate(..)

The above approach is the default behavior I know of. But did you prefer anything differently? Did you see the change event without any change should send something similar to “null” in the payload given no change happened instead of latest (which is also existing) change on “update” button click by user?