I have created a custom button
and a handler class
Everything works fine except for a visibility part where I have to check if Parent has some field set or not.
The problem is that
returns before
completes.
Code:
custom/Espo/Custom/Resources/metadata/clientDefs/Email.json
Code:
client/custom/src/createProductionHandler.js
Code:
isCreateProductionVisible() { if ((this.view.model.get('parentType') == 'Order') && this.view.model.get('parentId')) { Espo.Ajax.getRequest('Order/' + this.view.model.get('parentId')).then(order => { if (order.productionId) { console.log('Has Production'); return false; } else { console.log('Doesnt have Production'); return true; } }); } console.log('Leaving visibility check'); return !((this.view.model.get('parentType') == 'Production') && this.view.model.get('parentId')); }
Code:
isCreateProductionVisible
Code:
Espo.Ajax.getRequest
Comment