---
title: Update
slug: netsuite/tDgL-update
description: Learn how to update a Vendor Bill in NetSuite using code examples and the Breadwinner Global API. This document includes details about creating a map to store Vendor Bill data, initializing custom fields and line items, and adding line item custom fields.
docTags: 
createdAt: 2021-10-26T11:52:35.000Z
---

The following is an example of an update Vendor Bill where we are changing some of the fields (see [Vendor Bill](docId\:wmEla-0pAuxvjSE0u1faK) for all available fields). The NetSuite Vendor Bill Id (internalId) is required to update the Vendor Bill.

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

The response returns the complete Vendor Bill information, but we have shortened the response in our example for ease of reading.

:::CodeblockTabs
Request

```apex
//  Create a Map to store all the data of a VendorBill
    Map<String, Object> nsVendorBill = new Map<String, Object>();
    nsVendorBill.put('internalId', '113553');
    nsVendorBill.put('classification', new Map<String, Object>{'internalId'=>'2'});
    nsVendorBill.put('currencyRecord', new Map<String, Object>{'internalId'=>'1'});
    
    nsVendorBill.put('entity', new Map<String, Object>{'internalId'=>'362'});
    nsVendorBill.put('memo', 'Bill 30');
    nsVendorBill.put('otherRefNum', '4343390');
    nsVendorBill.put('tranDate', DateTime.newInstance(2021, 09, 07).getTime()/1000);

//  Initializing the VendorBill 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 VendorBill Custom Fields
    nsVendorBill.put('customFieldList', new Map<String,Object>{'customField'=>billCustomFieldList});

//  Initializing the VendorBill Line Items
    List<Object> lineItemList = new List<Object>();
    Map<String, Object> lineItem = new Map<String, Object>();
        lineItem.put('description', 'A weapon for shooting arrows test');
        lineItem.put('item', new Map<String, Object>{'internalId'=>'239'});
        lineItem.put('replaceAll', false);   
        lineItem.put('amount', 10);
        lineItem.put('quantity', 2);
        lineItem.put('grossAmt', 220);
        lineItem.put('tax1Amt', 210);
        lineItem.put('revRecEndDate', DateTime.newInstance(2021, 09, 07).getTime()/1000);
        lineItem.put('revRecStartDate', DateTime.newInstance(2021, 09, 07).getTime()/1000);

//  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', 'custbody_checkbox');
            liCustomField.put('value', 'true');
            liCustomFieldList.add(liCustomField);

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

//  Adding the Line Items to VendorBill
    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', 'updateVendorBill');
    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=updateVendorBill,
  timestamp=1667829702990,
  validRequest=true,
  version=1.0
  responseJSON= {
  "errors": [],
  "status": "200",
  "vendorBills": [
      {
        "userTotal": 220.0,
        "transactionNumber": "VENDBILL188",
        "tranId": null,
        "tranDate": 1630983600,
        "terms": null,
        "taxTotal": 33.56,
        "subsidiary": {
          "type": null,
          "name": "Parent Company",
          "internalId": "1",
          "externalId": null
        },
        "status": "Open",
        "salesforceID": "a025D00001ZM4qBQAT",
        "nullFieldList": null,
        "memo": "Bill 30",
        "location": null,
        "lastModifiedDate": 1667829698,
        "itemList": {
          "replaceAll": null,
          "item": [
            {
              "unitsDisplay": null,
              "taxRate1": "18.0",
              "taxCode": {
                "type": null,
                "name": "VAT_IN:GST 18",
                "internalId": "36",
                "externalId": null
              },
              "tax1Amt": 33.56,
              "shipMethod": null,
              "shipGroup": null,
              "serialNumbers": null,
              "revRecStartDate": null,
              "revRecSchedule": null,
              "revRecEndDate": null,
              "rate": "200.00",
              "quantityRemaining": null,
              "quantityReceived": null,
              "quantityPicked": null,
              "quantityPacked": null,
              "quantityOnHand": null,
              "quantityFulfilled": null,
              "quantityCommitted": null,
              "quantityBilled": null,
              "quantityBackOrdered": null,
              "quantityAvailable": null,
              "quantity": 2.0,
              "price": null,
              "poNum": null,
              "percentComplete": null,
              "orderLine": null,
              "onHand": null,
              "location": null,
              "line": 9,
              "jobName": null,
              "itemReceive": null,
              "itemName": null,
              "itemIsFulfilled": null,
              "item": {
                "type": null,
                "name": "Bow",
                "internalId": "239",
                "externalId": null
              },
              "grossAmt": 220.0,
              "expectedReceiptDate": null,
              "description": "A weapon for shooting arrows test",
              "department": null,
              "customFieldList": {
                "customField": [
                  {
                    "valueLookup": null,
                    "value": "false",
                    "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": 186.44
            }
          ]
        },
        "internalId": "113553",
        "fax": null,
        "externalId": null,
        "expenseList": null,
        "exchangeRate": 1.0,
        "entity": {
          "type": null,
          "name": "RM Textiles",
          "internalId": "30440",
          "externalId": null
        },
        "email": null,
        "dueDate": 1630983600,
        "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
        }
      }
    ],
  }, 
}
```
:::

