cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Changeset processing in CAP Node.JS

1,131

Hello,

We are porting a oData V2 Fiori project to use a CAP service instead. The CAP service is setup to receive the request and make a call to a on-premise system from BTP. While we can GET entity data, we are not able to receive POST changeset requests that the Fiori application sends. The requests in the changeset req seems to arrive at the server,js already split into individual requests.

Can CAP handle changeset requests? If so, can you please point us to some info.

Thanks for your time

Accepted Solutions (0)

Answers (2)

Answers (2)

david_kunz2
Product and Topic Expert
Product and Topic Expert

Hi selvarajb1 ,

At the moment, there's no possibility to register on `$batch` requests. It's only possible to add handlers to the application service, these will be then triggered for the individual requests.

Maybe it helps to implement a custom action. Then you're in full control of the processing.

Best regards,
David

mouradche
Explorer
0 Likes

Hi David,

(I'm new to CAP NodeJS)

Do you you know if this feature will be implemented in the futur in CAP NodeJS ?
Do you have any example or indication on how to implement a custom action/handler that could manage '$batch' requests ? (getting all the data contained in the change set at once) ?

Thank you / Best Regards

david_kunz2
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Mourad,

There are no specific plans to support custom handling of $batch requests.
Regarding the action/function: You can define the input/output of your function and write code to process it, no `$batch` needed here.

pedro_iranzo
Product and Topic Expert
Product and Topic Expert
0 Likes

I'm trying to set up something similar, where I want to select multiple items and use an action to process them together.

Even when using the ChangeSet option, the action logic is executed separately for each item, however, I've noticed that the HTTP header 'x-correlation-id' is the same for all selected items.

Before going ahead, I'd like someone else to confirm: can I use this header to identify all items that were selected?

See the annotation and the custom logic below:

{
    $Type : 'UI.DataFieldForAction',
    Label : 'Batch Action',
    Action: 'ApiService.batchAction',
    InvocationGrouping : #ChangeSet
}
this.on('batchAction', async (req) => {
      console.log('batchAction begin');
      console.log(req.headers['x-correlation-id']);
      console.log(req.params);
      console.log('batchAction end');
});

Regards,

Pedro