onCallFinished logic for manually executed stageActions. Logic needed - any suggestions?

Many of you will be familiar with the below 'onClick' event code when executing a workflow action (using a conventional button).

It would be nice if we could also integrate a success message, however more logic is needed similar to that of the event listener or callback mechanism in order to discern the stageAction status

If for example, an obligatory field is empty and the stage action button is executed, an error message is displayed and the action fails graciously.

Any suggestions?
Best regards

let actions = form.getStageActions(); // Obtain array of stage buttons
for ( let i = 0; i < actions.length; i++ ) { // Iterate through array
  if (get(actions, i).getId() === 'S_Submit1') { // Look for 'this' match
    get(actions,i).activate();
    break; // Exit loop   
      }; 
}; 

Does the setting on the form properties and on the resp. button in the "workflow" view not solve this issue?

Many thanks, unfortunately not in this case as I want to use the app.showMessage command.