0

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);
});
1
  • why don't you enable the action in your fiori using annotations? @UI.lineItem: [{ position: 10 }, { type: #FOR_ACTION, dataAction: 'read_file', label: 'Read File'}] Commented Sep 6 at 11:25

1 Answer 1

-2
var oAction = oModel.bindContext("/read_file(...)", oBindingContext);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.