Skip to Content
Dec 26, 2021 at 08:16 PM

Error when calling CAP bound action with input parameter from the UI

642 Views Last edit Dec 27, 2021 at 11:36 AM 5 rev

Hi all,

I have an entity set (Offers) which contains "guest" attribute that should be edited by selecting a desired row and clicking on "Book" button on the list report page .

entity Offers: managed 
  key ID : UUID @(Core.Computed : true);
  owner : String ; 
  place : String;
  startDate: Date;
  endDate : Date; 
  description : String;
  status: String default 'Available';
  guest : String

I am trying to call CAP bound action action from Fiori List report page that takes as input "myguest" and then update the entity field "guest" by selecting a desired row from the list and clicking on "book" button.00.png

after clicking on the Book button I get the Error below


here is my service definition

Service ParkingService {
 entity Offers as projection on pm.Offers actions { 
   action assignGuest(
      @UI.ParameterDefaultValue : in.guest 
      myguest : String 
 annotate ParkingService.Offers with @odata.draft.enabled;

and here is my custom handler

const cds = require('@sap/cds')
module.exports = function () {
 const { Offers } = cds.entities 
 this.on ('assignGuest', async (req)=> { 
  const id = req.params[0],
  gst =; 
  const n = await UPDATE(Offers,id) 
  .with({guest: gst, status: "booked"}) 
  n > 0 || req.error (404) 

I would much appreciate any feedback!

Best Regards



00.png (85.1 kB)
000.png (99.4 kB)
00000.png (96.1 kB)