Skip to Content
avatar image
Former Member

store the result of an odata method in a js variable

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 27, 2017 at 10:08 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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