setValue not working properly in freshdesk live

Whenever user click to ticketReply, I need to insert text for email signature.

In locally it’s working fine. But i deployed this as a custom app.After that in live it’s not working. properly.But recieved setvalue success response(attached screenshot).

If I clicked reply button once again, it’s appearing.

setValue is not working properly.

My code…

function eventCallback() {
  client.interface
    .trigger("setValue", {
      id: "editor",
      text: "Best Regards",
    })
    .then(function (data) {
      console.log("setValue Signature Success :", data);
    })
    .catch(function (error) {
      console.log("setValue Signature Failed :", error);
    });
}

client.events.on("ticket.replyClick", eventCallback);

setvalue issue response

Event is happening here, But setValue is not working properly.

you can see the exact issue in this video.I should select reply button two times.First time got the setValue response.But value has been not set.If I clicked second time. It’s appearing.

app.js file

var client;

init();

async function eventCallback() {
  await client.interface
    .trigger("setValue", {
      id: "editor",
      text: "Text to be inserted",
    })
    .then(function (data) {
      console.log("setValue Signature Success :", data);
    })
    .catch(function (error) {
      console.log("setValue Signature Failed:", error);
    });
}

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

  client.events.on("ticket.replyClick", eventCallback);
}

async function renderText() {
  const textElement = document.getElementById("apptext");
  const contactData = await client.data.get("contact");
  const {
    contact: { name },
  } = contactData;

  textElement.innerHTML = `Ticket is created by ${name}`;
}

@zach_jones_noel and freshworks @volunteers any update for my query?

Hey @Mohamed_Haneefa,

Thanks for reporting this. From the screen record you shared, I see that you need to click twice to get the signature set.

The code looks good to me, let me replicate this and get back to you.

Thanks @zach_jones_noel

Hi All,
I have shared zip file to @zach_jones_noel in private (https://community.freshworks.dev/t/private-message-setvalue-not-working-properly-in-freshdesk-live/7706) . I hope He is checking. if anyone know the solution, kindly let me know.

Hi @Mohamed_Haneefa,

Thanks for your patience while I reply. :slight_smile:

You would have to use the click trigger instead of setValue with the id reply

client.interface.trigger("click", {id: "reply", text: "Text to be inserted"})
.then(function(data) {
// data - success message
}).catch(function(error) {
// error - error object
});

More info in the docs.

Hope this helps.

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