Additional answer to zladuric,
you can use the failCallback method to show the message what you want. But it’s hard to find the failCallback method for business process forms for the new, because it uses workflow forms such as “Start Workflow”, “Edit Task”, “Task Details”.
For example, in the Start Workflow form, you can add our own successCallBack and failureCallBack by writing an onBeforeFormRuntimeInit event handler in workflow.js .
onBeforeFormRuntimeInit: function StartWorkflow_onBeforeFormRuntimeInit(layer, args) { var startWorkflowForm = Dom.get(this.generateId + "-form"); Event.addListener(startWorkflowForm, "submit", this._submitInvoked, this); args[1].runtime.setAJAXSubmit(true, { successCallback: { fn: this.onFormSubmitSuccess, scope: this }, failureCallback: { fn: this.onFormSubmitFailure, scope: this } }); } onFormSubmitSuccess: function StartWorkflow_onFormSubmitSuccess(response) { this.navigateForward(true); // Show your success message or do something. } onFormSubmitFailure: function StartWorkflow_onFormSubmitFailure(response) { var msgTitle = this.msg(this.options.failureMessageKey); var msgBody = this.msg(this.options.failureMessageKey); // example of showing processing response message // you can write your own logic if (response.json && response.json.message) { if(response.json.message.indexOf("ConcurrencyFailureException") != -1) { msgTitle = this.msg("message.concurrencyFailure"); msgBody = this.msg("message.startedAgain"); } else msgBody = response.json.message; } Alfresco.util.PopupManager.displayPrompt( { title: msgTitle, text: msgBody }); }
Since Alfresco.component.StartWorkflow (in start-workflow.js) extends Alfresco.component.ShareFormManager (in alfresco.js). You can override the onBeforeFormRuntimeInit event in start-workflow.js. Hope this helps you.
source share