cancel
Showing results for 
Search instead for 
Did you mean: 

Query to create draft for a child entity in composition

David21
Explorer
0 Kudos
149

Hello everyone,

I am using CAP(Node.js) odata V4 & listReport page template with fiori elements. I have two entities Lets say parent & child, they have a composition relation between them. The child entity table is displayed on the object page and there i have added a custom action button which opens a valuehelp dialog and there user can add multiple entries from the value valuehelp. The reason custom button was added was that it enables the user to add multiple entries in one go and he doesnt have to create it one by one using the create button. When you try to create an entry in child table using create button the call that is sent is this : 

NEW Parent(ID=123,IsActiveEntity=false)/child
i want to replicate this call. I tried using the following but it didnt work :
await this.send({
            query: INSERT.into(`Parent(ID=${req.params[0].ID},IsActiveEntity=false)/child`).entries(data),
            event: "NEW ",
        });
Any ideas how to solve this ?
View Entire Topic
MattBrightman
Explorer
0 Kudos

 

Checkout the code for fillEntities handler

 

 await this.create(ServiceAuth.drafts).entries({
            to_ServiceRole_RoleUUID: RoleUUID,
            AuthType_AuthorisationType: req.data.AuthorisationType,
            DraftAdministrativeData_DraftUUID: entity.DraftAdministrativeData_DraftUUID,
            AuthEntity_EntityUUID: entity.EntityUUID
          })

 

 
David21
Explorer
0 Kudos
Appreciate the answer, It works now.