How to create related records with a single call using SOAP

Posted by mzorbis on 22-May-2015 03:23

Hi,

I'm using the SOAP API to create two records with a createArr call:

Record 1 is object A with a lookup field (related object set to object B)

Record 2 is object B

There is a one to many relationship set between object A and B.

The question is -

Is it possible to create these two records with a _single_ call to the createArr method?

The reason why I'm asking is because I have no id value for the parent record (Record 1) when defining the child record (Record 2) fields because the parent record has not yet been created.

Many thanks!

Marcin.

All Replies

Posted by Anoop Premachandran on 22-May-2015 07:15

This is not supported as of now

Posted by Gian Torralba on 22-May-2015 07:18

Hello,

What you can do is create the first object using SOAP method create(). The return type of the create() is the ID of the newly created record so you can pass this to the second create() you need. Please see Rollbase User Guide, Chapter 14: "References".

Thank you,
Gian

Posted by pvorobie on 22-May-2015 12:11

Please try rbv_api.setSharedValue() and rbv_api.getSharedValue()

This way you should be able to pass values (ID of parent record) from record to record while in the same database transaction.

Posted by mzorbis on 22-May-2015 14:26

Thank you. Is there any way to achieve this using the REST API?

Posted by pvorobie on 22-May-2015 17:26

This should work for REST API createArr as well.

This thread is closed