Edwin Schravesande6028557
Posts: 0
Joined: Tue Jul 09, 2013 2:44 pm

mapping stopping when coding succes?

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 
      } 
 });
Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

mapping stopping when coding succes?

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:

Edwin Schravesande6028557
Posts: 0
Joined: Tue Jul 09, 2013 2:44 pm

mapping stopping when coding succes?

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.

Return to “Issues”