Skip to Content
0

store the result of an odata method in a js variable

Apr 27, 2017 at 09:22 AM

27

avatar image
Former Member

Hello everyone,

I created a fiori app along with its odata service and implemented its methods.

I also created a method in my odata service that contains a boolean variable as its output and i want to store it in a variable in javascript in sap fiori.

I don't know how to call this method in sap fiori js so that i can receive the result and store it in a js variable.

Any answer would be helpful.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
VIPLOVE KHUSHALANI Apr 27, 2017 at 10:08 AM
0

Hi Anas Najem,

Just get the model attach to the view or to the component and call oData model read method and on the success property of read method you will get the boolean variable in the response ... that you can save it in javascript variable .

thanks

Viplove

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

can you please show me a sample of code so that i can understand

0

var model = this.getOwnerComponent().getModel();

model.read("<servicePath which will call the functions which returns the boolean>",{success:function(response){

//response will variable will contain your boolean variable

}})

thanks

Viplove

0