Hi guys.
First of all, y’all are doing a great work!!
I’m working on a Freshservice app that among other things hides the element dueDateEdit of the ticket on certain interface events. The app is working flawless except for 1 case: changing a ticket property (status in this case) and clicking update shows the dueDateEdit element back on the interface, ignoring any client.interface.trigger("hideElement", {id: "dueDateEdit",});
calls. Also, every call of this interface method raises an Error “undefined”, making the debugging process very painfull. My code is as shown bellow:
async function hideDueDateEdit(client) {
console.log("algar hidding");
try {
const data = await client.interface.trigger("hideElement", {
id: "dueDateEdit",
});
return { error: null, data };
} catch (error) {
// NOTE: Always Raises "undefined"
console.trace({ hideDueDateEdit: error });
return { error, data: null };
} dueDateEdit
}
async function hideAll() {
try {
const client = await app.initialized();
const { error: errorHide0, data } = await hideDueDateEdit(client);
/*BUG: hideDueDateEdit Always returns Error(undefined)*/
// if (errorHide0) {
// throw new Error(errorHide0);
// }
/*NOTE: ESCONDE TUDO*/
Object.values(EVENTS).forEach((eventsForHidding) => {
eventsForHidding.forEach((event) => {
client.events.on(event, async (e) => {
const { error: errorHideLoop, data } = await hideDueDateEdit(client);
// BUG: same
// if (errorHideLoop) {
// throw new Error(errorHideLoop);
// }
});
});
});
} catch (error) {
console.trace({ renderApp: error });
}
}
For testing purposes, the EVENTS
Object contains all interface events, and it’s defined as bellow:
const EVENTS = {
APP_EVENTS: ["app.activated", "app.deactivated"],
TICKET_EVENTS: [
"ticket.propertiesLoaded",
...
],
...
};
A video of what happens when I change the ticket status and updates it:
Thanks in advance!!!