---
title: Creation of Child Custom Object Record
slug: netsuite/creation-of-child-custom-object-record
description: Learn how to create a Child Custom Object Record with this comprehensive document. Discover how to set values for all available fields using Apex language and ensure a successful API call. Gain insight into the response that includes data of the new recor
docTags: 
createdAt: 2023-08-10T12:51:55.125Z
---

The following is an example of creating a Child Custom Object Record where we are setting every possible field (See [﻿](https://app.archbee.io/docs/-LIHUUnv_7XNQrtzHsKkC/hnjmkN99QxWdEafyYIFSq)﻿[﻿](https://app.archbee.io/docs/-LIHUUnv_7XNQrtzHsKkC/EmQjIKnClZE-b-zi9PinN)[Custom Object](docId\:fGPsbggFpzat8WQLDCqU1)  for the available fields). The response will return the exact request data plus the new NetSuite Child Custom Object Id (internalId) and the newly created Salesforce Child Custom Object Id (salesforceID).

:::hint{type="info"}
Here, the Internal Id of the Parent Custom Object Record has to be passed in. Only then will this record be treated as a Child Custom Object Record.
:::

:::CodeblockTabs
Request

```apex
//  Create a Map to store all the data of a Custom Object
	Map<String, Object> nsCustomObject = new Map<String, Object>();
    nsCustomObject.put('name', 'other object record');
	nsCustomObject.put('isInactive', false);
         
//  Initializing the Custom Object Custom Fields
    List<Object> customObjectCustomFieldList = new List<Object>();
    
    Map<String,Object> parentObjectLookupfield= new Map<String,Object>();
        parentObjectLookupfield.put('fieldType', 'string');
        parentObjectLookupfield.put('scriptId', 'custrecord239');
        parentObjectLookupfield.put('value', '2626');
        customObjectCustomFieldList.add(parentObjectLookupfield);

    Map<String,Object> customObjectCustomField1 = new Map<String,Object>();
        customObjectCustomField1.put('fieldType', 'string');
        customObjectCustomField1.put('scriptId', 'cusrecord240');
        customObjectCustomField1.put('value', 'Hello World');
        customObjectCustomFieldList.add(customObjectCustomField1);
    
    Map<String,Object> customObjectCustomField2 = new Map<String,Object>();
        customObjectCustomField2.put('fieldType', 'string');
        customObjectCustomField2.put('scriptId', 'custrecord241');
        customObjectCustomField2.put('value', '9');
        customObjectCustomFieldList.add(customObjectCustomField2);
            
//  Adding the Custom Object Custom Fields
    nsCustomObject.put('customFieldList', new Map<String,Object>{'customField'=>customObjectCustomFieldList});
    
//  Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
    requestJSONMap.put('customObjectRecords', new List<Object>{nsCustomObject});
    requestJSONMap.put('customObjectID', '196');
    String reqJSON = JSON.serialize(requestJSONMap);
    
Map<String, Object> reqObj = new Map<String, Object>();
    reqObj.put('version', '1.0');
    reqObj.put('action', 'createCustomObjectRecord');
    reqObj.put('requestJSON', reqJSON);
    
//  Placing a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);
```

Response

```json
{
  action=createCustomObjectRecord,
  timestamp=1691673464883,
  validRequest=true,
  version=1.0,
  responseJSON={
    "errors": [],
    "status": "200",
    "customObjectRecords": [
      {
        "salesforceID": "a0f1e000001rKmeAAE",
        "recType": {
          "name": "Order Child",
          "internalId": "196"
        },
        "owner": {
          "name": "Praveena U",
          "internalId": "4"
        },
        "name": "other object record",
        "lastModified": 1691673463,
        "isInactive": false,
        "internalId": "608",
        "customFieldList": {
          "customField": [
            {
              "valueLookup": {
                "name": "Parent Object Record",
                "internalId": "2626"
              },
              "value_array": null,
              "value": null,
              "scriptId": "custrecord239",
              "label": null,
              "isParent": null,
              "isMandatory": null,
              "isFormula": null,
              "internalId": "860",
              "fieldType": null,
              "displayType": null,
              "description": null,
              "defaultValue": null,
              "defaultChecked": null,
              "accessLevel": null
            },
            {
              "valueLookup": null,
              "value_array": null,
              "value": "false",
              "scriptId": "custrecord243",
              "label": null,
              "isParent": null,
              "isMandatory": null,
              "isFormula": null,
              "internalId": "864",
              "fieldType": null,
              "displayType": null,
              "description": null,
              "defaultValue": null,
              "defaultChecked": null,
              "accessLevel": null
            },
            {
              "valueLookup": null,
              "value_array": null,
              "value": "9",
              "scriptId": "custrecord241",
              "label": null,
              "isParent": null,
              "isMandatory": null,
              "isFormula": null,
              "internalId": "862",
              "fieldType": null,
              "displayType": null,
              "description": null,
              "defaultValue": null,
              "defaultChecked": null,
              "accessLevel": null
            }
          ]
        },
        "created": 1691673463
      }
    ]
    
  }
}
```
:::

