---
title: Create
slug: netsuite/LzD3-create
description: Learn how to create a custom object record in Salesforce and NetSuite using Apex code and JSON format. This document provides a comprehensive example showcasing all available fields, including the newly generated NetSuite and Salesforce Custom Object IDs.
docTags: 
createdAt: 2022-03-29T09:11:53.000Z
---

To create a Custom Object Record in NetSuite, use action as "createCustomObjectRecord" and pass the Custom Object Record data in the requestJSON under "customObjectRecords".

:::hint{type="info"}
Note: You can only create one record at a time.
:::

The following is an example of creating a 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 response back from NetSuite, which includes the NetSuite Custom Object Record Id (internalId), plus the newly created Salesforce ﻿Custom Object Record Id (salesforceID)

:::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', 'Custom Record-2');
	nsCustomObject.put('isInactive', false);
         
    //  Initializing the Custom Object Custom Fields
    List<Object> customObjectCustomFieldList = new List<Object>();
    Map<String,Object> customObjectCustomField = new Map<String,Object>();
        customObjectCustomField.put('fieldType', 'string');
        customObjectCustomField.put('scriptId', 'custrecord172');
        customObjectCustomField.put('value', 'Custom Field Value-1');
        customObjectCustomFieldList.add(customObjectCustomField);
            
//  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', '11');
    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=1648544293785,
 validRequest=true, 
 version=1.0, 
 responseJSON={
   "errors":[],
   "status":"200",	
   "customObjectRecords":[
      {
         "salesforceID":"a0Z0l000006NnOoEAK",
         "recType":{
            "name":"Brand List",
            "internalId":"11"
         },
         "owner":{
            "name":"Navaneeth.D",
            "internalId":"4"
         },
         "name":"Custom Record-2",
         "lastModified":1648544292,
         "isInactive":false,
         "internalId":"808",
         "customFieldList":{
            "customField":[
               {
                  "valueLookup":null,
                  "value_array":null,
                  "value":"Custom Field Value-1",
                  "scriptId":"custrecord172",
                  "label":null,
                  "isParent":null,
                  "isMandatory":null,
                  "isFormula":null,
                  "internalId":"675",
                  "fieldType":null,
                  "displayType":null,
                  "description":null,
                  "defaultValue":null,
                  "defaultChecked":null,
                  "accessLevel":null
               }
            ]
         },
         "created":1648544292
      }
   ]
 }
}

```
:::



