Hi!
Let me explain my situation. I have created custom detail view for Task entity. I added button to this view, which opens modal dialog. In this modal dialog user selects assignedUser and enother entity jobInstruction, which is related to selected user. When user clicks 'Done', I user Espo.Ajax.postRequest method to relate selected entites. After that, detail view is rerendered and I see, that selected entites are updated, but my workflow rule afterUpdate assignedUser is not triggered. What am I missing in my code?
Here is modal dialog code before close:
And here is how I catch done event on parent view:
Let me explain my situation. I have created custom detail view for Task entity. I added button to this view, which opens modal dialog. In this modal dialog user selects assignedUser and enother entity jobInstruction, which is related to selected user. When user clicks 'Done', I user Espo.Ajax.postRequest method to relate selected entites. After that, detail view is rerendered and I see, that selected entites are updated, but my workflow rule afterUpdate assignedUser is not triggered. What am I missing in my code?
Here is modal dialog code before close:
PHP Code:
actionSave: function () {
// some code to get entities ids
(async () => {
const [assignedUserResponse, jobInstructionResponse] = await Promise.all([
Espo.Ajax.postRequest('Task/' + this.options.taskId + '/assignedUser', {
id: userId
}),
Espo.Ajax.postRequest('Task/' + this.options.taskId + '/jobInstruction', {
id: jobInstructionId
})
]);
if (assignedUserResponse && jobInstructionResponse) {
Espo.Ui.success(this.translate('Done'));
} else {
Espo.Ui.error(this.translate('Error'));
}
this.trigger('done', 'view is closed');
this.close();
})();
}
And here is how I catch done event on parent view:
PHP Code:
actionAssignExecutorButtonClick: function () {
this.createView('dialog', 'custom:views/modals/assign-executor-dialog', {
teamId: this.model.get('teamsIds')[0],
taskId: this.model.get('id')
}, view => {
view.render();
this.listenToOnce(view, 'done', response => {
this.model.fetch();
this.reRender();
});
});
},
Comment