---
title: Create
slug: netsuite/i7_2-create
description: Learn how to create a Vendor Bill in NetSuite using the "createVendorBill" action with this comprehensive document. Discover all the essential data fields such as classification, location, currency, and more that need to be provided. Also, explore how to 
docTags: 
createdAt: 2021-10-26T11:39:15.000Z
---

To create a Vendor Bill in NetSuite, use action as "createVendorBill" and pass the Vendor Bill data in the requestJSON under "vendorBills".

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

The following is an example of create Vendor Bill where we are setting every possible field (See [Vendor Bill](docId\:wmEla-0pAuxvjSE0u1faK) for the available fields). The response will return the response back from NetSuite, which includes the new NetSuite Vendor Bill Id (internalId), plus the newly created Salesforce ﻿Vendor Bill Id (salesforceID)

:::CodeblockTabs
Request

```apex
//  Create a Map to store all the data of a Vendor Bill
Map<String, Object> nsVendorBill = new Map<String, Object>();
    nsVendorBill.put('classification', new Map<String, Object>{'internalId'=>'5'});
    nsVendorBill.put('location', new Map<String, Object>{'internalId'=>'13'});
    nsVendorBill.put('currencyRecord', new Map<String, Object>{'internalId'=>'1'});
    nsVendorBill.put('department', new Map<String, Object>{'internalId'=>'2'});
    nsVendorBill.put('dueDate', DateTime.newInstance(2020, 12, 31).getTime()/1000);
    nsVendorBill.put('approvalstatus', new Map<String, Object>{'internalId'=>'2'});
    nsVendorBill.put('entity', new Map<String, Object>{'internalId'=>'30440'});
    nsVendorBill.put('shipTo', new Map<String, Object>{'internalId'=>'362'});
    nsVendorBill.put('memo', 'Bill 12');
    nsVendorBill.put('otherRefNum', '4343399');
    nsVendorBill.put('tranDate', DateTime.newInstance(2020, 09, 07).getTime()/1000);

//  Initializing the Vendor Bill Custom Fields
    List<Object> billCustomFieldList = new List<Object>();
    Map<String, Object> billCustomField = new Map<String, Object>();
        billCustomField.put('fieldType', 'select');
        billCustomField.put('scriptId', 'custbody_customlist');
        billCustomField.put('valueLookup', new Map<String, Object>{'internalId'=>'2'});
        billCustomFieldList.add(billCustomField);

//  Adding the Vendor Bill Custom Fields
    nsVendorBill.put('customFieldList', new Map<String, Object>{'customField'=>billCustomFieldList});

//  Initializing the Vendor Bill Line Items
    List<Object> lineItemList = new List<Object>();
    Map<String, Object> lineItem = new Map<String, Object>();
        lineItem.put('description', 'A weapon for shooting arrows');
        lineItem.put('item', new Map<String, Object>{'internalId'=>'239'});
        lineItem.put('quantity', 1);
        lineItem.put('rate', '999');

//  Initializing the Line Item custom fields
        List<Object> liCustomFieldList = new List<Object>();
        Map<String, Object> liCustomField = new Map<String, Object>();
            liCustomField.put('fieldType', 'boolean');
            liCustomField.put('scriptId', 'custcol_checkbox');
            liCustomField.put('value', 'true');
            liCustomFieldList.add(liCustomField);

//  Adding the Vendor Bill Line Item Custom Fields
        lineItem.put('customFieldList', new Map<String, Object>{'customField'=>liCustomFieldList});
        lineItemList.add(lineItem);

//  Adding the Line Items to Vendor Bill
    Map<String, Object> billLineitemList = new Map<String, Object>();
        billLineitemList.put('item', lineItemList);
    nsVendorBill.put('itemList', billLineitemList);

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

Map<String, Object> reqObj = new Map<String, Object>();
    reqObj.put('version', '1.0');
    reqObj.put('action', 'createVendorBill');
    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=createVendorBill,
  timestamp = 1621574690167,
  validRequest = true,
  version = 1.0,
  responseJSON={
    "status": "200",
    "errors": [],
    "vendorBills": [
      {
        "userTotal": 1178.82,
        "transactionNumber": "VENDBILL188",
        "tranId": null,
        "tranDate": 1599447600,
        "terms": null,
        "taxTotal": 179.82,
        "subsidiary": {
          "type": null,
          "name": "Parent Company",
          "internalId": "1",
          "externalId": null
        },
        "status": "Open",
        "salesforceID": "a025D00001ZM4qBQAT",
        "nullFieldList": null,
        "memo": "Bill 12",
        "location": null,
        "lastModifiedDate": 1667824104,
        "itemList": {
          "replaceAll": null,
          "item": [
            {
              "unitsDisplay": null,
              "taxRate1": "18.0",
              "taxCode": {
                "type": null,
                "name": "VAT_IN:GST 18",
                "internalId": "36",
                "externalId": null
              },
              "tax1Amt": 179.82,
              "shipMethod": null,
              "shipGroup": null,
              "serialNumbers": null,
              "revRecStartDate": null,
              "revRecSchedule": null,
              "revRecEndDate": null,
              "rate": "999.00",
              "quantityRemaining": null,
              "quantityReceived": null,
              "quantityPicked": null,
              "quantityPacked": null,
              "quantityOnHand": null,
              "quantityFulfilled": null,
              "quantityCommitted": null,
              "quantityBilled": null,
              "quantityBackOrdered": null,
              "quantityAvailable": null,
              "quantity": 1.0,
              "price": null,
              "poNum": null,
              "percentComplete": null,
              "orderLine": null,
              "onHand": null,
              "location": null,
              "line": 1,
              "jobName": null,
              "itemReceive": null,
              "itemName": null,
              "itemIsFulfilled": null,
              "item": {
                "type": null,
                "name": "Bow",
                "internalId": "239",
                "externalId": null
              },
              "grossAmt": 1178.82,
              "expectedReceiptDate": null,
              "description": "A weapon for shooting arrows",
              "department": null,
              "customFieldList": {
                "customField": [
                  {
                    "valueLookup": null,
                    "value": "true",
                    "scriptId": "custcol_checkbox",
                    "internalId": "443",
                    "fieldType": null
                  },
                  {
                    "valueLookup": null,
                    "value": "ERROR: Field 'custcol7' Not Found",
                    "scriptId": "custcol11",
                    "internalId": "656",
                    "fieldType": null
                  }
                ]
              },
              "createPo": null,
              "costEstimateType": null,
              "costEstimate": null,
              "classification": null,
              "amount": 999.0
            }
          ]
        },
        "internalId": "113553",
        "fax": null,
        "externalId": null,
        "expenseList": null,
        "exchangeRate": 1.0,
        "entity": {
          "type": null,
          "name": "RM Textiles",
          "internalId": "30440",
          "externalId": null
        },
        "email": null,
        "dueDate": 1609383600,
        "department": null,
        "customForm": {
          "type": null,
          "name": "Standard Vendor Bill",
          "internalId": "50",
          "externalId": null
        },
        "customFieldList": {
          "customField": [
            {
              "valueLookup": null,
              "value": "false",
              "scriptId": "custbody34",
              "internalId": "558",
              "fieldType": null
            },
            {
              "valueLookup": null,
              "value": " - ",
              "scriptId": "custbody_breadwinner_pc_internal_id",
              "internalId": "588",
              "fieldType": null
            },
            {
              "valueLookup": {
                "type": null,
                "name": "B",
                "internalId": "2",
                "externalId": null
              },
              "value": null,
              "scriptId": "custbody_customlist",
              "internalId": "458",
              "fieldType": null
            },
            {
              "valueLookup": null,
              "value": "false",
              "scriptId": "custbody_enableimport",
              "internalId": "691",
              "fieldType": null
            },
            {
              "valueLookup": null,
              "value": "false",
              "scriptId": "custbody_checkbox",
              "internalId": "272",
              "fieldType": null
            }
          ]
        },
        "currencyRecord": {
          "type": null,
          "name": "INR",
          "internalId": "1",
          "externalId": null
        },
        "currencyName": "INR",
        "createdDate": 1667824104,
        "classification": null,
        "billingAddress": null,
        "approvalStatus": {
          "type": null,
          "name": "Approved",
          "internalId": "2",
          "externalId": null
        }
      }
    ],
  }
}
```
:::

