1// Create a Map to store all the data of a Custom Object
2Map<String, Object> nsCustomObject = new Map<String, Object>();
3 nsCustomObject.put('internalId', '808');
4 nsCustomObject.put('name', 'Custom Record-2 update');
5 nsCustomObject.put('isInactive', true);
6
7 // Initializing the Custom Object Custom Fields
8 List<Object> customObjectCustomFieldList = new List<Object>();
9 Map<String,Object> customObjectCustomField = new Map<String,Object>();
10 customObjectCustomField.put('fieldType', 'string');
11 customObjectCustomField.put('scriptId', 'custrecord172');
12 customObjectCustomField.put('value', 'Custom Field Value-1 update');
13 customObjectCustomFieldList.add(customObjectCustomField);
14
15// Adding the Custom Object Custom Fields
16 nsCustomObject.put('customFieldList', new Map<String,Object>{'customField'=>customObjectCustomFieldList});
17
18// Initializing the RequestJSON Data to be passed.
19Map<String, Object> requestJSONMap = new Map<String, Object>();
20 requestJSONMap.put('customObjectRecords', new List<Object>{nsCustomObject});
21 requestJSONMap.put('customObjectID', '11');
22 String reqJSON = JSON.serialize(requestJSONMap);
23
24Map<String, Object> reqObj = new Map<String, Object>();
25 reqObj.put('version', '1.0');
26 reqObj.put('action', 'updateCustomObjectRecord');
27 reqObj.put('requestJSON', reqJSON);
28
29// Placing a request to Breadwinner Global API
30Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
31System.debug(resp);