I'm following this guide. I thought about trying this as well, but the official way is probably better.
Here are my files:
custom/Espo/Custom/Resources/i18n/en_US/EntityName.json:
custom/Espo/Custom/Resources/metadata/clientDefs/EntityName.json:
client/custom/src/process-visits-handler.js
I see the button in the mass action menu, but I don't know what to do from here. I am currently running a job on a schedule to perform an action, but I would like it to be called on demand using the mass action button. How do I call a PHP function using the button? I saw this, but I can't figure out how to use it or what it means:
A few other things - I could not get the button to work until I named everything exactly the same way: processVisits. The functions in the js file also have to be named the same way: initProcessVisits and actionProcessVisits. This detail is not mentioned in the guide, which is confusing.
Here are my files:
custom/Espo/Custom/Resources/i18n/en_US/EntityName.json:
Code:
...
},
"massActions": {
"processVisits": "Process Visits"
}
}
Code:
{
"controller": "controllers/record",
"boolFilterList": [
"onlyMy"
],
"massActionList": [
"__APPEND__",
"processVisits"
],
"checkAllResultMassActionList": [
"__APPEND__",
"processVisits"
],
"massActionDefs": {
"processVisits": {
"handler": "custom:process-visits-handler",
"initFunction": "initProcessVisits"
}
}
}
Code:
define('custom:process-visits-handler', [], function () {
var ProcessVisitsHandler = function (view) {
this.view = view;
};
_.extend(ProcessVisitsHandler.prototype, {
initProcessVisits: function() {
console.log("got here");
},
actionProcessVisits: function (data) {
console.log("got here2");
},
});
return ProcessVisitsHandler;
});
You can use Mass Action framework to handle mass actions in the back-end. Available since v6.2.0. Send a POST request to MassAction URL with data passed into the action method.

Comment