Skip to Content

CAP / Fiori execute bound action for multiple entities in Fiori worklist page

Dear experts,

I am trying to run a custom action for multiple entities in a Fiori worklist page. I find that running an action inline (for 1 entity) works as expected, but annotating the action globally for multiple selected entities does not.

Here is my service definition:

service ResellerService @(path:'manage-packages') {
    entity Apps as projection on db.Apps;   
    entity Orders as projection on db.Orders;
    entity OrderItems as projection on db.OrderItems 
        actions {
            action packaging ( ) returns String;        
        }
    ;
}

Here is the Fiori worklist annotation for the action with inline rendering:

annotate ResellerService.OrderItems with @(
    UI: {
        LineItem: [
            {$Type: 'UI.DataField', Value: ID, Label: '{i18n>ID}'},
            {$Type: 'UI.DataField', Value: parent.externalreference, Label: '{i18n>Order Reference}'},
            {$Type: 'UI.DataField', Value: app.app, Label: '{i18n>App}'},
            {$Type: 'UI.DataField', Value: app.description, Label: '{i18n>Description}'},
            {$Type: 'UI.DataField', Value: quantity, Label: '{i18n>Free Quantity}'},
            {   $Type: 'UI.DataFieldForAction', 
                Label:'{i18n>Create License Package}', 
                Action:'ResellerService.EntityContainer/OrderItems_packaging', 
                Inline: true  } 
        ]
    }
);

This renders as expected and invoking the action on a line base works as expected - with the somewhat odd behavior that the entity ID is submitted in the query params instead of in the payload but it works.

However, if I change the action annotation to be not inline:

{$Type: 'UI.DataFieldForAction', 
 Label:'{i18n>Create License Package}', 
 Action:'ResellerService.EntityContainer/OrderItems_packaging', 
 Inline: false  } 

The element does render as expected with a global action:

However, if I now select one or several lines in the worklist, I am getting the following error before anything is even sent to the backend (example with 2 lines selected).

If I select continue anyway, the action is called, but with an empty payload and no query params, so my backend can't know which lines the user invokes the action for.

Since the action is meant for bundling different items together, inline-invoking isn't feasible.

Can anyone help with invoking actions for multiple entities? Is there something I am missing?

Best regards,

Manuel

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on May 23, 2020 at 06:44 AM

    So from my own trial and error it looks like what I was missing was:

    1. Bound actions cannot be invoked for multiple entities in Fiori (unsure, but couldn't get it to work)

    2. Fiori Elements will only map entity key fields to action parameters automatically (without a popup to the user), but not non-key fields

    I ended up with the following workaround:

    Defined the action as unbound and added a ListReport controller extension to the Fiori WorkList template so that I have client-side control over the action parameters. I am invoking the action from the UI5 extension API using

    https://sapui5.hana.ondemand.com/#/api/sap.suite.ui.generic.template.ListReport.extensionAPI.ExtensionAPI%23methods/invokeActions

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.