Skip to Content
0
Sep 21, 2021 at 01:57 AM

[MDK] OData Action CreateEntity with Relationship on CAP failure

131 Views Last edit Sep 21, 2021 at 08:47 AM 2 rev

Hey experts, i'm newbie with MDK and CAP development and my question is with an unreal exemple, but with the same relationships:

I'm trying to save and entity with an OData CreateEntity action. On my model, I have 3 entities with these fiedls:

user-management.cds > User entity:

entity Users {
        key id               : String(10);
            internalRegister : String(10);
            email            : String(241);
            firstName        : String(40);
            lastName         : String(40);
}

work-order.cds > Work Order entity:

entity WorkOrder {
        key id          : String(10);
            description : String(100);
}

work-order.cds > Execution entity:

entity Execution {
        key workOrder   : Association to WorkOrder;
        key user        : Association to Users;
}

I'm trying to save with my ODataAction selecting the User in a ListPicker and WorkOrder in another. The return value is the "id" of the both.

When I try to save, I'm gotting an failure.

So, what is the correct way to create the entity with this relationship? And what about the CreateLinks, what is the application for this option?