Issue: custom action not called or triggered in Fiori app.
Action taken: I was trying to trigger the custom action from the behavior definition when a button is pressed in my Fiori app.
I have a Fiori app which is created thru "connect to a system", OData service which is also connected to the Fiori app.
In Odata service has a behavior definition and class.
Inside the class, there is a private method called read_file.
Inside the behavior definition I tried to call the read_file using the syntax:
action read_file result [0..*} $self
In my Fiori app I have a submit button that should trigger the custom action using this code:
View.xml:
<Button text="Submit" press="onSubmit"/>
Main.controller.js:
var oModel = this.getView().getModel();
var oBindingContext = this.getView().getBindingContext();
var oAction = oModel.bindContext("read_file()", oBindingContext);
oAction.execute().then(function(oResult) {
MessageToast.show("File read success");
console.log(oResult);
}).catch(function(oError) {
MessageBox.error(oError.message);
});
@UI.lineItem: [{ position: 10 }, { type: #FOR_ACTION, dataAction: 'read_file', label: 'Read File'}]