Issue with Open Reply and Insert Text Method

Hi all,

When creating a new app we want to leverage the editor window methods. However, when trying to open the reply editor and insert text, the editor opens but no text is inserted. If the editor is already open with the button is pressed, this error is thrown.

" The 'reply’ editor is already open. If you just want to add text to the existing window, use the setValue interface API instead."

This is our code.

client.interface.trigger("click", {id: "reply", text: content}).catch(handleErrResultAction);

It’s strange because the same code works perfectly for the note.

Thank you in advance for your guidance!

1 Like

can you please share with us the error message which you get when opening and inserting the text into the editor?

Thanks

@Santhosh this is the error message when the method is triggered if the editor is already open.

Otherwise, the editor will open if it is not already, but no text will be inserted.

@Santhosh @Thakur_Ganeshsingh any guidance here? Are we missing a step in our code?

Thank you in advance!

Hi @Henry_Kremer ,

I believe you are describing two cases here,

  1. Opening a new editor when clicked, the mentioned text is not being inserted
  2. If the editor is already open, then error use setValue interface API instead

In the first scenario the expected behaviour is as per ticketopenreply, where usage would be as
depicted

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

In the latter part when the window is already open, there wont be a need for opening a new editor instead the text is to be inserted as mentioned in ticketinserteditorwindow. Since the editor is already open the usage would be as depicted below

client.interface.trigger(
"setValue", {id: "editor", text: "Text to be inserted",
attachments: [attachment ID1, attachment ID2...]})
.then(function(data) {
// data - success message
}).catch(function(error) {
// error - error object
});

In scenarios when an editor is already open the system would result in error

" The 'reply’ editor is already open. If you just want to add text to the existing window, use the setValue interface API instead."

Having said that, could you please confirm if our understanding is same.

Regards,
Thakur

2 Likes

Hi @Thakur_Ganeshsingh,

This is correct. We do not understand why no text is being inserted in the first scenario.

Thanks for confirming the details @Henry_Kremer,

I appreciate your patience and support.

I tried reproducing the mentioned scenario locally by registering events. With below snippet I found the methods working as expected.

  var content = "welcome home soldier"
  client.interface.trigger("click", {id: "reply", text: content}).catch(handleErrResultAction);

Could you please share the code snippets or steps to reproduce the mentioned scenario in our local setup?

Below are the steps that we shall follow once the details are shared

  1. Use the steps to reproduce scenario locally. If the issue is pertinent then, I shall raise a ticket with product team to get it corrected.
  2. If there are any issues with code then we could check for any code abnormalities and resolve them in an office hour

Regards,
Thakur

2 Likes

Thank you, @Thakur_Ganeshsingh ,

  if (msgData['eventType'] == "sendLinkToReply" || msgData['eventType'] == "sendTextToReply") {
    client.interface.trigger("click", {id: "reply", text: content}).catch(handleErrResultAction);
  }

triggers this console error:

For further context the below code for notes works correctly.

  if (msgData['eventType'] == "sendLinkToNote" || msgData['eventType'] == "sendTextToNote") {
    client.interface.trigger("click", {id: "note", text: content, isPublic: true}).catch(handleErrResultAction);
  }

Hi @Thakur_Ganeshsingh - Have you been able to reproduce our issues locally? Any advice would be greatly appreciated. Thank you!

Hi @Henry_Kremer ,

I tried replicating issue locally. Could you please add the video recording of the issue here?

Thanks,
Thakur

Hi @Henry_Kremer ,

Thanks for sharing the details and the screen recoding video. I shall connect with product team and get you more details.

Regards,
Thakur

Hi @Thakur_Ganeshsingh - are there any updates here?

Hi @Henry_Kremer,

Appreciate your patience. Thanks for reaching out.
As I mentioned earlier I raised the issue with relevant team. Additionally, raised a ticket with Support Desk team, and is being evaluated by L2 support team. I shall keep you updated on progress.

Regards,
Thakur

Hello - is there any update here? Thank you

Hi @Henry_Kremer ,

The ticket has been logged here. It is being handled by L2 support team.

Regards,
Thakur

I can’t see the ticket. Can you please add me in CC? hkremer@yext.com

1 Like

Hi @Henry_Kremer ,
If you landed reply page, Open Note and Insert Text interface API should not works.
You can use setValue API instead

client.interface.trigger(
"setValue", {id: "editor", text: "Text to be inserted",
attachments: [attachment ID1, attachment ID2...]})
.then(function(data) {
// data - success message
}).catch(function(error) {
// error - error object
});

For example: Whenever ticketReply is clicked, text will be inserted using eventCallback.

function eventCallback() {
    client.interface
      .trigger("setValue", { id: "editor", text: "Text to be inserted" })
      .then(function (data) {})
      .catch(function (error) {});
  }

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

I hope it’ll help.