cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Fiori Elements Side Effect not working with custom Action

iperez-sofos
Participant
438
Greetings, community experts.
 
I am developing a CAP application (OData V4), with SAP Fiori Element for the UI, on SAP BTP.
 
For a specific functionality, I have had to implement a custom action (as explained here: https://sapui5.hana.ondemand.com/sdk/#/topic/7619517a92414e27b71f02094bd08d06.html), invoked via ExtensionAPI (invokeAction method: https://sapui5.hana.ondemand.com/#/api/sap.fe.core.controllerextensions.EditFlow%23methods/invokeAct...).
 
The issue is that, although the action is running correctly, the corresponding Side Effects are not working.
 
My Custom Action defines a button in the header of an Object Page, which invokes a Bounded Action in my CAP service. The corresponding Side Effect must update a text label in the same header.
 
Definition of Bounded Action (CDS):
 
    actions {
        function existePDF() returns RespExistArch;
        function existeXML() returns RespExistArch;
 
        @(cds.odata.bindingparameter.name: '_it',
          Common.SideEffects: {
            TargetProperties: ['_it/estatRevision', '_it/textRevision', '_it/criticalidadRevision']
        })
        action ponerEstatusRevisado();
    };
 
 
JavaScript function in the extension controller, which invokes the Action:
 
sap.ui.define([
    "sap/m/MessageToast",
    "sap/m/BusyDialog",
    "sacep/m/MessageBox",
"sap/m/PDFViewer",
    "sap/ui/core/library"],
    function(MessageToast, BusyDialog, MessageBox, PDFViewer, coreLibrary) {
        'use strict';
 
        return {
 
            actualizarEstatus: function(oEvent) {
                let sActionName = "AdminSrv.ponerEstatusRevisado()";
                let oParameters = {
                    contexts: oEvent.oBinding,    //getSource().getBindingContext(),
                    model: oEvent.oModel,         //getSource().getModel(),
                    label: 'Confirm',
                    invocationGrouping: true
                };
 
                this.editFlow.invokeAction(sActionName, oParameters).then(function(reslt) {
                    console.log("SUCCESS");
                    //reslt.oBinding.refresh();
 
                }).catch(function(err) {
                    console.log("ERROR: ", err);
                });
 
            },
        };
});
 
As you can see, I have changed the values ​​for the contexts and model fields, since the getSource() function returns undefined (the function does not exist in the oEvent object). I don't know if that change I made is the cause of the problem.
 
For now, for the changes to be visible in the Object Page header, the page must be refreshed manually.
 
In advance, thanks for any help and/or suggestions.

Accepted Solutions (0)

Answers (0)