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