myapp.Calc.SkipOrder_Tap_canExecute = function (screen) {
var enabledBool = new Boolean;
screen.getOrders().then(function (result) {
enabledBool = (screen.OrderPosition < result.data.length - 1);
});
return enabledBool;
};
The SkipOrder_Tap is a button object in MS LightSwitch. The problem is, I need to return the Boolean AFTER the asynchronous call.
myapp.Calc.FirstOrder_Tap_canExecute().then(function(enabled) { ...});. Learn more about.then: api.jquery.com/deferred.then