It's All About the Platform.

  • January 18, 2018

Creating Child Custom Object Records Using RESTful Services

Richard Bingham
Senior Development Manager

As shown below on the Custom Objects page in Application Composer it says all child custom objects provide access to their REST Resource "Via Parent", but what does this mean exactly and how do you work with this?

In essence it means the child object records have to be queried (and created, updated, or deleted) always in the context of a single parent record. So for example if you created Opportunity 210511 then to work with Opportunity Revenue Lines you'd have to specify which parent record that applies, in this case 210511.  This makes sense because child records exist only for their parent record and you cannot create a reusable child record that can be referenced by more than one parent (for that you'd create another top level Object and a Relationship).

Querying Children

To find the child records you include the Primary Key ID field value in the rest resource URI, after the object API name. Then the /child/ folder and finally the Collection Name you specified when creating your child object.

Let's use an example to illustrate this, based on custom objects. My parent custom object is FishingKit_c and has a child object Rod_c which forms the collection name RodCollection_c.

To return all the child records of my 'Carp Fishing UK' FishingKit record, I first determine it has the ID 300000009209985. This is shown in the response when it was first created, or I can see this by querying it using a simple REST request as explained here. The following would be then be URI that I would issue my GET request to return the child records:


Here is the same using a Windows REST Client program to illustrate use:


Creating Children

As you'd probably imagine, the POST request to create records is done to the same child collection URL based on a single parent record ID.


Obviously the payload needs to include Required fields as a minimum, so as shown below in my simple case this is just the RecordName. Oh and don't forget media type: application/vnd.oracle.adf.resourceitem+json.

Update and delete operations are exactly the same, always including the parent record ID in the Resource URI.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.