on 2024 Jan 09 8:28 AM
Hello CAP team,
I am attempting to capture a PATCH request within a CAP service that is triggered when fields are changed in a draft mode creation form of an entity. However, I am unable to detect any logs indicating that the PATCH handler has been triggered.
From my service cds file:
@odata.draft.enabled
entity Materials as projection on WNBGReferencesApp.Materials
Output example in console:
[odata] - POST /service/WNBGReferencesApp/$batch
[odata] - > PATCH Materials(ID=8c8e8a5a-6475-4094-9916-d8eeff98cf32,IsActiveEntity=false)
[odata] - > READ References(ID=e3ff58e7-4e59-4fa1-b258-93e287419560,IsActiveEntity=false)/materials(ID=8c8e8a5a-6475-4094-9916-d8eeff98cf32,IsActiveEntity=false)
PATCH handler:
this.before('PATCH', 'Materials', async(req) => { console.log("Material PATCH IS TRIGGERED") });
I am not sure what I am missing. (I am a beginner)
With lean draft, handlers for PATCH requests to drafts need to be attached to UPDATE of the draft entity. This would be this.entities.Materials.draft in your case.
See documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
10 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.