Can we make snippet to wait until called snippet execution completed

if we are calling a snippet from another snippet like

var SaveQLIModels = skuid.snippet.getSnippet('SaveQLIModels');<br>SaveQLIModels ();

Can we make the current snippet to wait until SaveQLIModels snippet execution is completed.

I tried using

$.when(SaveQLIModels()).done(function(){<br>**Remaining logic**<br>})

but it not waiting until snippet SaveQLIModels() execution complete. Let me know what I am missing her.

Thanks in advance for the help.

I think you need a call back function, which proceeds once your save is successful.[MyModel], {callback: function(result){
if (result.totalsuccess) {

// rest of your logic
} else {
//logic if the save fails
return false;

Thanks Chandra for a quick reply.
Here in my scenario, I am calling another snippet. so this


will return a function and that function should have a callback to execute the remaining logic?

Dinesh, you might also be able to set up a Model Action on the model that’s being saved. You can use “model saved” as the trigger, then set up an action sequence that runs the SaveQLIModels snippet. 

By the way, if your SaveQULIModels snippet is just saving other models, you can set up the same kind of model action sequence to do that declaratively, whenever the first model is saved.

@Mark, yes initially models save was defined declaratively and after that we are calling a snippet. but unfortunately all those declarative actions are firing asynchronously. So some time before save of models completed snippet is firing and it is holding the old data. That is the main reason, we wrote snippet for models save and calling another snippet on success of models save.