Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8411

ODataModel.submitChanges() with two associated newly created entries

$
0
0

Hello Community,

 

I have this doubt,

 

I have this entity 'Person' in NW Gateway, with:

Id (PK)

FirstName

LastName

 

And 'Relationship':

Person1Id (PK)

Person2Id(PK)

ValidFrom

ValidTo

/Person1 (Association by Person1Id)

/Person2 (Association by Person2Id)

 

I create a new person with ODataModel.createEntry(/People, { FirstName : "Juan", LastName : "Duran" });

But, what if I want to create a new 'Relationship' and two 'Person's INLINEd?

 

 

Something like:

var oContext = ODataModel.createEntry(/People, { FirstName : "Juan", LastName : "Duran" });

ODataModel.createEntry('Relationships', { Person1: { FirstName : "Martha", LastName : "Argerich", Person2 : oContext.getObject() } });

 

What I want to do, is associate two newly created Entries, and submit my changes and send the payload ONLY to /Relationships?

 

What's the better practice?

 

Thank you


Viewing all articles
Browse latest Browse all 8411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>