Issue with set Value interface API in Freshdesk

Hi There,

Whenever the user clicks email’s reply button, I will add some content in email body.

By using this method I have achieved the current scenario and it working properly but text is getting added multiple times in email body per click.

FYR:
I have attached the code and screenshot.

$(document).ready(function () {

    app.initialized().then(function (_client) {

        window.client = _client;

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

    })

});

var eventCallback = async function (event) {

    const response = await client.interface.trigger("setValue", { id: "editor", text: "test" });

    console.log(response, "response here");

};

Is there any update on this?

Not really sure what’s causing this, I tried running this sample app which demonstrates the usage of Interface API, and I could able to insert content to the editor perfectly. @Bala_kumar can you try the same and look at the code.

2 Likes

I tried with same format but its not working as expect the text is displaying twice in the Email editor.

Hello @Bala_kumar

If you refer to the documentation for this interface method, you will note that -

By default, the text is appended at the current cursor position. The optional replace parameter, which is boolean, can be used to replace the existing content or add to it.

So the behaviour you notice, that is the text is appended to the existing test value when the button is clicked the 2nd time, is expected. Consider using the replace parameter if you wish to overwrite the existing text in the window.

Do let us know if this works for you.

2 Likes

@Bala_kumar If it’s still an issue at your end, could you try changing your environment in terms of computer, browser, and local vs custom app, and tell us if you could make it work?

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