Is there a way to stop actions from firing in Summer '14?

There are two ways to stop actions from firing from a Snippet:

(a) [Available as of Skuid 5.4, which is now available] Return false from your Snippet. This will cause the Action Framework to check for On-Error Actions defined for the current Action, and run that sequence of On-Error Actions, and NOT run any successive actions.

Example: From a Wizard Step Button, you might want to validate that all Required Fields have been filled out before navigating to the next step, or performing some other actions in the action framework. Here is an example Snippet that would do this, validating Required Fields on an Account and Contact Model being created in the current step:

var params = arguments[0],&nbsp; &nbsp; <br>&nbsp; &nbsp; step = params.step,<br>&nbsp; &nbsp; stepEditor = step.editor,<br>&nbsp; &nbsp; $ = skuid.$;<br>// Clear our list of messages<br>stepEditor.clearMessages();<br>var models = [<br>&nbsp; &nbsp;skuid.model.getModel("Account"),<br>&nbsp; &nbsp;skuid.model.getModel("Contact")<br>];<br>var messages = [];<br>$.each(models,function(i,model){<br>&nbsp; &nbsp;$.each(model.registeredLists,function(j,list){<br>&nbsp; &nbsp; &nbsp; &nbsp;var listMessages = list.validateRequiredFields();<br>&nbsp; &nbsp; &nbsp; &nbsp;if(listMessages &amp;&amp; listMessages.length) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$.each(listMessages,function(){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; messages.push(this);&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});<br>&nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp;});<br>});<br>// If we have warning messages, do NOT proceed<br>if (messages.length) {<br>&nbsp; &nbsp; // Have our step's editor handle the messages<br>&nbsp; &nbsp; stepEditor.handleMessages(messages); <b> // Stop the Action Sequence, and execute any on-error actions</b><br>&nbsp; &nbsp; <b>return false;<br></b>}<br>// Otherwise proceed!


(b) If you are doing a bunch of asynchronous operations within your Snippet, you can return a jQuery Deferred as part of a result object. If you call reject() on this Deferred, then the Action Sequence will be terminated and any on-error actions will be run. 

Example:

var params = arguments[0],   
    step = params.step,
    stepEditor = step.editor,
    $ = skuid.$,
    deferred = $.Deferred();

// Clear our list of messages
stepEditor.clearMessages();

var models = [skuid.model.getModel(“Account”),skuid.model.getModel(“Contact”)];
var messages = ;
$.each(models,function(i,model){
   $.each(model.registeredLists,function(j,list){
       var listMessages = list.validateRequiredFields();
       if(listMessages && listMessages.length) {
           $.each(listMessages,function(){
              messages.push(this); 
           });
       }
   });
});

// If we have warning messages, do NOT proceed
if (messages.length) {
    // Have our step’s editor handle the messages
    stepEditor.handleMessages(messages);
    deferred.reject({
         messages: messages,
         step: step,
         wizard: params.wizard
    });
} else {
     deferred.resolve({
         step: step,
         wizard: params.wizard   
    });
}
return { deferred: deferred };