Update
1 min
The following is an example of updating a Contact where we are changing only the email address. (See Contact for all available fields). The NetSuite contact Id (internalId) is required to update the contact.
Note: You can only update one record at a time.
The response returns the complete contact information, but we have shortened the response in our example for ease of reading.
// Create a Map to store all the data of a Contact
Map<String, Object> nsContact = new Map<String, Object>();
//Pass internalId to update the Contact
nsContact.put('internalId', '63547');
nsContact.put('email', '[email protected]');
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('contacts', new List<Object>{nsContact});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'updateContact');
reqObj.put('requestJSON', reqJSON);
// Placing a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);