Skip to Content
2
May 22, 2020 at 04:11 PM

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

533 Views Last edit May 22, 2020 at 04:12 PM 2 rev

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