Get the value in real time ifrom custom field

Hello everyone,

I hope you’re all doing well. I would like to inquire if it’s possible to detect in real-time when an agent types into a custom field within Freshdesk’s new ticket form. Over a year ago, I created a custom application, but at that time, it wasn’t possible to capture the data entered into that field in real-time without shifting focus away from the field. Nowadays, I’m curious to find out if this is now achievable, as I’ve attempted it without success. Here is the code I’ve been using:

var client;

init();

async function init() {
  client = await app.initialized();
  client.events.on('app.activated', renderText);
  client.events.on('app.activated', boton);
 
}

$(document).ready ( function() {
  app.initialized().then(function(client) {
  window.client = client; 
  client.events.on("ticket.customFieldChanged", eventCallBack);     
});
});




async function eventCallBack(event) {
  


  var customField = event.data; 
  var test = customField.cf_test.new; 

  setTimeout(function () {console.log('updated')},5000);
  const textFields = document.querySelectorAll('[name="customFields.cf_test"]');
  const statusElement = document.getElementById('status');
  const typingTimers = new Map();
  const typingTimeout = 1000; // Adjust the timeout value as needed

  textFields.forEach(textField => {
    textField.addEventListener('input', () => {
      const timer = typingTimers.get(textField);

      if (timer) {
        clearTimeout(timer);
      }

      

      typingTimers.set(textField, setTimeout(() => {
      console.log("e; agente");
      }, typingTimeout));
    });
  });

  
}

Thank you

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.