---
title: Update
slug: netsuite/cERf-update
description: Learn how to update a Return Authorization in NetSuite with this comprehensive guide. Discover how to update important fields such as classification, currency record, department, discount item, and entity, along with useful insights on custom fields and l
docTags: 
createdAt: 2021-10-26T11:52:35.000Z
---

The following is an example of updating Return Authorization where we are changing some of the fields. (See [Return Authorization](docId\:TvP5sq2fB4IS2tIIg2Aqk) for all available fields).  The NetSuite Return Authorization Id (internalId) is required to update the Return Authorization.

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

The response returns the complete Return Authorization 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 RMA
Map<String, Object> nsRMA = new Map<String, Object>();
    nsRMA.put('internalId', '86840');
    nsRMA.put('classification', new Map<String, Object>{'internalId'=>'2'});
    nsRMA.put('currencyRecord', new Map<String, Object>{'internalId'=>'1'});
    nsRMA.put('department', new Map<String, Object>{'internalId'=>'1'});
    nsRMA.put('discountItem', new Map<String, Object>{'internalId'=>'-6'});
    nsRMA.put('discountRate', '-20');
    nsRMA.put('entity', new Map<String, Object>{'internalId'=>'362'});
    nsRMA.put('memo', 'Order 30');
    nsRMA.put('otherRefNum', '4343390');
    nsRMA.put('tranDate', DateTime.newInstance(2021, 09, 07).getTime()/1000);

//  Initializing the RMA Custom Fields
    List<Object> rmaCustomFieldList = new List<Object>();
    Map<String,Object> rmaCustomField = new Map<String,Object>();
        rmaCustomField.put('fieldType', 'select');
        rmaCustomField.put('scriptId', 'custbody_customlist');
        rmaCustomField.put('valueLookup', new Map<String,Object>{'internalId'=>'2'});
        rmaCustomFieldList.add(rmaCustomField);

//  Adding the RMA Custom Fields
    nsRMA.put('customFieldList', new Map<String,Object>{'customField'=>rmaCustomFieldList});

//  Initializing the RMA 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 RMA Line Item Custom Fields
        lineItem.put('customFieldList',new Map<String,Object>{'customField'=>liCustomFieldList});
        lineItemList.add(lineItem);

//  Adding the Line Items to RMA
    Map<String, Object> rmaLineitemList = new Map<String, Object>();
        rmaLineitemList.put('item',lineItemList);
    nsRMA.put('itemList',rmaLineitemList);

//  Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
    requestJSONMap.put('returnAuthorizations', new List<Object>{nsRMA});
    String reqJSON = JSON.serialize(requestJSONMap);

Map<String, Object> reqObj = new Map<String, Object>();
    reqObj.put('version', '1.0');
    reqObj.put('action', 'updateReturnAuthorization');
    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 = updateReturnAuthorization,
  timestamp = 1621574690167,
  validRequest = true,
  version = 1.0,
  responseJSON = {
  "status": "200",
  "errors": [],
  "returnAuthorizations": [
    {
      "tranId": "85",
      "tranDate": 1630936800,
      "totalCostEstimate": null,
      "total": 200,
      "taxTotal": 0,
      "subTotal": 220,
      "subsidiary": {
        "type": null,
        "name": "Parent Company",
        "internalId": "1",
        "externalId": null
      },
      "status": "Pending Receipt",
      "source": "Web Services",
      "salesRep": null,
      "salesforceID": "a0M5Y00000dWFt2UAG",
      "salesEffectiveDate": 1630936800,
      "otherRefNum": "4343390",
      "orderStatus": "_pendingReceipt",
      "nullFieldList": null,
      "memo": "Order 30",
      "location": null,
      "lastModifiedDate": 1621574677,
      "itemList": {
        "replaceAll": null,
        "item": [
          {
            "unitsDisplay": null,
            "taxRate1": "0.0",
            "taxCode": {
              "type": null,
              "name": "VAT_IN:UNDEF-IN",
              "internalId": "5",
              "externalId": null
            },
            "tax1Amt": 0,
            "shipMethod": null,
            "shipGroup": null,
            "serialNumbers": null,
            "revRecStartDate": null,
            "revRecSchedule": null,
            "revRecEndDate": null,
            "rate": "100.00",
            "quantityRemaining": null,
            "quantityReceived": 0,
            "quantityBilled": 0,
            "quantity": 2,
            "price": {
              "type": null,
              "name": "Base Price",
              "internalId": "1",
              "externalId": null
            },
            "poNum": null,
            "orderLine": null,
            "onHand": null,
            "location": null,
            "line": 4,
            "jobName": null,
            "itemReceive": null,
            "itemName": null,
            "itemIsFulfilled": null,
            "item": {
              "type": null,
              "name": "Bow",
              "internalId": "239",
              "externalId": null
            },
            "grossAmt": 220,
            "expectedReceiptDate": null,
            "description": "A weapon for shooting arrows test",
            "department": null,
            "customFieldList": null,
            "createPo": null,
            "costEstimateType": null,
            "costEstimate": null,
            "classification": null,
            "amount": 220
          }
        ]
      },
      "internalId": "86840",
      "externalId": null,
      "entity": {
        "type": null,
        "name": "21 Atherton Grocery",
        "internalId": "362",
        "externalId": null
      },
      "discountTotal": -20,
      "discountRate": "-20.00",
      "discountItem": {
        "type": null,
        "name": "Partner Discount",
        "internalId": "-6",
        "externalId": null
      },
      "department": {
        "type": null,
        "name": "PR Department",
        "internalId": "1",
        "externalId": null
      },
      "customForm": {
        "type": null,
        "name": "Custom Return Authorization - Credit",
        "internalId": "109",
        "externalId": null
      },
      "customFieldList": {
        "customField": [
          {
            "valueLookup": null,
            "value": " - ",
            "scriptId": "custbody_breadwinner_pc_internal_id",
            "internalId": "299",
            "fieldType": null
          },
          {
            "valueLookup": null,
            "value": "false",
            "scriptId": "custbody23",
            "internalId": "271",
            "fieldType": null
          },
          {
            "valueLookup": null,
            "value": "2021-05-20 22:24:37",
            "scriptId": "custbodylastmodifieddate",
            "internalId": "298",
            "fieldType": null
          }
        ]
      },
      "currencyRecord": null,
      "currencyName": "INR",
      "createdFrom": null,
      "createdDate": 1621573302,
      "classification": {
        "type": null,
        "name": "Individual Partner Class",
        "internalId": "2",
        "externalId": null
      }
    }
  ]
 }
}

```
:::

