Hey Community,
I experience some unexpected behavior with removing quoted text in email reply editor.
So what I try to achieve is to remove the quoted text only for a specific ticket.product_id.
Thats my code:
var client;
init();
async function init() {
client = await app.initialized();
client.events.on('app.activated', appActivated);
client.events.on("ticket.replyClick", onReplyClicked);
}
async function onReplyClicked() {
const [iparams, ticketData] = await Promise.all([
client.iparams.get(),
client.data.get("ticket")
]);
if (iparams.ticketProducts.includes(ticketData.ticket.product_id)) {
try {
await client.interface.trigger("click", { id: "deleteQuotedText" });
console.log("Action executed because product ID matched.");
} catch (error) {
console.error("Error executing action:", error);
}
} else {
console.log("Product ID does not match. Action not executed.");
}
}
Testing it on a single ticket works perfectly fine, so
- Open ticket
- Click on reply
- Send the email
- No quoted text at receiver’s side
So now assuming, that the next ticket is a ticket, which does not match configured products (iparams.ticketProducts).
When I go to that next ticket with key ‘j’ or if the next ticket loads automatically, because I close/resolve the first one on sending, the quoted text is missing aswell (in UI and at receiver’s side)!
And that happens even though I see my comment:
Only after I reload the whole “non matching” ticket, I can send quoted text again.
It seems that the “deleteQuotedText” is removing quoted text for as long as the ticket details page isn’t fully reloaded, where I’d have expected to check for each ticket loaded.
Anyone else experienced this issue? Anyone resolved it?
Looking forward to your suggestions.
Thank you and Best regards
Tom