Skip to Content
0
Aug 18, 2020 at 04:05 PM

Fiori Elements extension - displaying messages in response from custom Action (List Report)

785 Views

Hi all,

I have added a custom action to the toolbar of a Fiori Elements List Report Page and implemented its functionality in the OData service. I can't implement the action using annotations as I require both multiple selection on the List and an additional parameter on the action.

In my extension controller, I have successfully put in a call to the extendedAPI.invokeActions() method and can see the response being returned.

I would now like to display these messages in the same way that they are displayed when invoking a (non-custom) action (i.e. single success in a message toast, single error or multiple messages in a dialog). I have been trying to debug the UI5 code for hours, but I am an ABAP developer with a sketchy understanding of JavaScript and I haven't come across what I'm looking for.

How can I add these messages to some sort of message handler and get them displayed?

Many thanks,

Andrew

P.S. Here's the code in my extension controller

sap.ui.controller("myApp.ext.controller.ListReportExt", {
    onCustomAction: function (oEvent) {
        var oApi = this.extensionAPI;
        var aSelectedContexts = oApi.getSelectedContexts();
        var mParameters = {
            "MyCustomParameter": "<a_value_determined_in_the_app>"
        };
        oApi.invokeActions("ENTITYSET/CustomAction", aSelectedContexts, mParameters).then(
            function (oResponse) {
                // Display the messages returned in the response
            },
            function (oError) { 
                // Display the messages returned in the response
            });
    }
});