Page 1 of 1

mapping stopping when coding succes?

Posted: Fri Aug 30, 2013 6:33 am
by Edwin Schravesande6028557

Hello there,

With the help of your forum posts, I worked out how to deal with services working from script. But now it seems like filling local vars from the response, is not operating any more. Like appery is either triggering the succes actions I scripted, or the map I did in the GUI, but not both.
Is this either to be expected, or would you think I made some stupid mistake?

Here's my basic syntax:

serviceInstance.execute({

Code: Select all

     data: {var1:"valuevar1"}.  

     success : function(data){ 
            // things to do on success 
      }, 

     error : function(data){ 
             // things to do on error 
      } 
 });

mapping stopping when coding succes?

Posted: Fri Aug 30, 2013 10:29 am
by Maryna Brodina

Hello! When you write such code for example:
codeserviceInstance.execute({
success: function( e ) {
alert(1);
}
});/code
you override Appery success handler (with all it's responce mapping).
If you want to handle success manually without overriding response mapping, you have to write something like this:
codeserviceInstance.options.onComplete = function(){
alert(1);
};
test.execute();/code
However, it's not the best approach. It is better to add click event on "Success" button with action "Invoke service" and select "serviceInstance" dataservice. Then go to Data - Events - select "test" as Component - select "Success" as event - select "Run JavaScript" as action - add script:


mapping stopping when coding succes?

Posted: Fri Aug 30, 2013 1:45 pm
by Edwin Schravesande6028557

Alright, thanx a lot. I love the mapping and selecting event actions from the menu, but when handeling a sequence of queries, it's more convenient to work just from script. I'm glad overriding the response mapping is supposed to happen instead of me being stupid. I'll just manually script the response mapping too, no problem.