I've got the following handler:
Lead config in buttons:
It is set up similarly to other handlers I have. Except for the fact the other handlers open a modal with a form sending an AJAX request from there. So this one is set up easier than the rest.
However on click I get the following error:
I would think something is wrong in my config but everything seems to be correct.
Code:
define(['action-handler'], (Dep) => {
return class extends Dep {
async logMessageSent(data, e) {
this.view.disableMenuItem('logMessageSent');
Espo.Ajax.postRequest('lead/action/logMessageSent', {
id: this.view.model.id
})
.then((response) => {
this.view.model.fetch();
this.view.reRender();
Espo.Ui.success('Bericht gestuurd.');
})
.catch(() => {
Espo.Ui.error('Bericht verstuurd kon niet worden gelogd.');
})
.finally(() => {
this.view.enableMenuItem('logMessageSent');
});
}
isLogMessageSentVisible() {
return this.view.model.attributes.status === 'message_to_be_sent';
}
}
});
Code:
{
"label": "Bericht Gestuurd",
"name": "logMessageSent",
"action": "logMessageSent",
"style": "default",
"acl": "edit",
"aclScope": "Lead",
"handler": "custom:handlers/log-message-sent-handler",
"actionFunction": "logMessageSent",
"checkVisibilityFunction": "isLogMessageSentVisible"
}
However on click I get the following error:
Code:
Uncaught TypeError: Cannot read properties of undefined (reading 'call') at espo-main.js:655:27 at Object._load (loader.js:702:21) at Object.require (loader.js:437:22) at Object.require (loader.js:1140:20) at Object.handleAction (espo-main.js:653:21) at click .action (espo-main.js:26563:20) at HTMLDivElement.dispatch (jquery.js:5136:27) at f.handle (jquery.js:4940:28)

Comment