---
title: Create
slug: netsuite/create
description: Learn how to create a contact in NetSuite effortlessly with this detailed guide. Follow instructions on utilizing the "createContact" action and passing contact data in the requestJSON. Discover how to set various fields, including first name, last name, 
docTags: 
createdAt: 2021-10-27T16:25:07.000Z
---

To create a Contact in NetSuite, use action as "createContact" and pass the Contact data in the requestJSON under "contacts".

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

The following is an example of createContact where we are setting most of the fields (See [Contact](docId:3GJo07dAqjxtJeAYY3sl9) for all the available fields).  The response will return the response back from NetSuite, which includes the new NetSuite ﻿Contact Id (internalId), plus the newly created Salesforce ﻿Contact Id (salesforceID)

:::CodeblockTabs
Request

```apex
 //  Create a Map to store all the data of a Contact
Map<String, Object> nsContact = new Map<String, Object>();
    nsContact.put('firstName', 'James');
    nsContact.put('lastName','Williams');
    nsContact.put('subsidiary', new Map<String, Object>{'internalId'=>'1'});
    nsContact.put('email', 'james@grandhotel.com');
    nsContact.put('company', new Map<String, Object>{'internalId'=>'32342'});
    nsContact.put('phone', '3453254543');
    nsContact.put('officePhone', '6546564564');
    nsContact.put('title', 'CEO');
    nsContact.put('isPrivate', true);

//  Initializing the Contact Custom Fields
    List<Object> conCustomFieldList = new List<Object>();
    Map<String, Object> conCustomField1 = new Map<String, Object>();
        conCustomField1.put('fieldType', 'boolean');
        conCustomField1.put('scriptId', 'custentity_f3_mm_send_wf_sms');
        conCustomField1.put('value', 'true');
        conCustomFieldList.add(conCustomField1);
    Map<String, Object> conCustomField2 = new Map<String, Object>();
        conCustomField2.put('fieldType', 'string');
        conCustomField2.put('scriptId', 'custentity_alt1_email');
        conCustomField2.put('value', 'james12@gmail.com');
        conCustomFieldList.add(conCustomField2);

//  Adding the Contact Custom Fields
    nsContact.put('customFieldList', new Map<String, Object>{'customField'=>conCustomFieldList});

//  Initializing the Contact Addresses
    List<Object> addressBookList = new List<Object>();
    Map<String, Object> addressBook = new Map<String, Object>();
    Map<String, Object> addressbookAddress = new Map<String, Object>();
        addressbookAddress.put('addr1', 'Suite 201');
        addressbookAddress.put('addr2', '2334 Park Street Avenue');
        addressbookAddress.put('city', 'Chicago');
        addressbookAddress.put('state', 'IL');
        addressbookAddress.put('country', '_unitedStates');
        addressbookAddress.put('zip', '60601');
        
        addressBook.put('addressbookAddress', addressbookAddress);
        addressBook.put('defaultBilling', true);
        addressBook.put('defaultShipping', true);
        
        addressBookList.add(addressBook);
    
    nsContact.put('addressbookList', new Map<String, Object>{'addressbook'=>addressBookList}); 

//  Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
    requestJSONMap.put('contacts', new List<Object>{nsContact});
    String reqJSON = JSON.serialize(requestJSONMap);

Map<String, Object> reqObj = new Map<String, Object>();
    reqObj.put('version', '1.0');
    reqObj.put('action', 'createContact');
    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=createContact,
  timestamp=1607423183079,
  validRequest=true,
  version=1.0,
  responseJSON={
    "status": "200"
    "errors": [],
    "contacts": [
      {
        "title": "CEO",
        "subsidiary": {
          "type": null,
          "name": "Parent Company",
          "internalId": "1",
          "externalId": null
        },
        "salutation": null,
        "salesforceID": "a022w00000IXl0bAAD",
        "publicSubscriptionStatus": null,
        "phone": "3453254543",
        "officePhone": "6546564564",
        "nullFieldList": null,
        "mobilePhone": null,
        "middleName": null,
        "lastName": "Williams",
        "lastModifiedDate": 1607423181,
        "isPrivate": true,
        "isInactive": false,
        "internalId": "32542",
        "homePhone": null,
        "firstName": "James",
        "fax": null,
        "externalId": null,
        "entityId": "James Williams",
        "email": "james@grandhotel.com",
        "defaultAddress": "James Williams\nSuite 201\n2334 Park Street Avenue\nChicago IL 60601\nUnited States",
        "dateCreated": 1607423180,
        "customForm": null,
        "customFieldList": {
          "customField": [
            {
              "valueLookup": null,
              "value": "true",
              "scriptId": "custentity_f3_mm_send_wf_sms",
              "internalId": "428",
              "fieldType": null
            },
            {
              "valueLookup": null,
              "value": "james12@gmail.com",
              "scriptId": "custentity_alt1_email",
              "internalId": "485",
              "fieldType": null
            }
          ]
        },
        "company": {
          "type": null,
          "name": "CUST533AT Grand Hotels & Resorts Ltd",
          "internalId": "32342",
          "externalId": null
        },
        "comments": null,
        "assistant": null,
        "altEmail": null,
        "addressbookList": {
          "replaceAll": null,
          "addressbook": [
            {
              "label": "Suite 201",
              "isResidential": null,
              "internalId": "29889",
              "defaultShipping": true,
              "defaultBilling": true,
              "addressbookAddress": {
                "zip": "60601",
                "state": "IL",
                "internalId": null,
                "country": "_unitedStates",
                "city": "Chicago",
                "attention": null,
                "addrPhone": null,
                "addressee": "James Williams",
                "addr3": null,
                "addr2": "2334 Park Street Avenue",
                "addr1": "Suite 201"
              }
            }
          ]
        }
      }
    ]
  }
}
```
:::

&#x20;

