Update Vendor
Sample Requests and Responses
The following is an example request which can be used while using ‘updateVendor’ action.
Request
// Create a Map to store all the data of a Vendor
Map<String, Object> nsVendor = new Map<String, Object>();
nsVendor.put('internalId', '32442');
nsVendor.put('currencyRecord', new Map<String, Object>{'internalId'=>'2'});
nsVendor.put('terms', new Map<String, Object>{'internalId'=>'5'});
nsVendor.put('category', new Map<String, Object>{'internalId'=>'4'});
nsVendor.put('email', 'john@pyramid.com');
nsVendor.put('phone', '7897734343');
// Initializing the Vendor Custom Fields
List<Object> vendCustomFieldList = new List<Object>();
Map<String,Object> vendCustomField1 = new Map<String,Object>();
vendCustomField1.put('fieldType', 'date');
vendCustomField1.put('scriptId', 'custentity_renewal_date');
vendCustomField1.put('value', String.valueOf(DateTime.newInstance(2020, 12, 26).getTime()/1000));
vendCustomFieldList.add(vendCustomField1);
Map<String,Object> vendCustomField2 = new Map<String,Object>();
vendCustomField2.put('fieldType', 'String');
vendCustomField2.put('scriptId', 'custentity_vendor_description');
vendCustomField2.put('value', 'Vendor for the Construction Materials');
vendCustomFieldList.add(vendCustomField2);
// Adding the Vendor Custom Fields
nsVendor.put('customFieldList', new Map<String,Object>{'customField'=>vendCustomFieldList});
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('vendors', new List<Object>{nsVendor});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'updateVendor');
reqObj.put('requestJSON', reqJSON);
// Placing a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);
Response
{
action=updateVendor,
timestamp=1607420691759,
validRequest=true,
version=1.0,
responseJSON={
"status": "200",
"errors": [],
"vendors": [
{
"url": "https://www.pyramid.com",
"title": null,
"terms": {
"type": null,
"name": "1% 10 Net 30",
"internalId": "5",
"externalId": null
},
"taxItem": null,
"taxIdNum": null,
"subsidiary": {
"type": null,
"name": "Parent Company",
"internalId": "1",
"externalId": null
},
"salutation": null,
"salesforceID": "a012w00000XUnDLAA1",
"phone": "7897734343",
"payablesAccount": {
"type": null,
"name": "Accounts Payable",
"internalId": "114",
"externalId": null
},
"nullFieldList": null,
"mobilePhone": null,
"middleName": null,
"legalName": null,
"lastName": null,
"lastModifiedDate": 1607420689,
"isPerson": false,
"isJobResourceVend": false,
"isInactive": false,
"isAccountant": null,
"is1099Eligible": null,
"internalId": "32442",
"incoterm": null,
"homePhone": null,
"firstName": null,
"fax": null,
"externalId": null,
"expenseAccount": null,
"entityId": "Pyramid Construction Inc.",
"email": "john@pyramid.com",
"dateCreated": 1607419609,
"customForm": {
"type": null,
"name": "Custom Vendor Form",
"internalId": "4",
"externalId": null
},
"customFieldList": {
"customField": [
{
"valueLookup": null,
"value": "1608921000",
"scriptId": "custentity_renewal_date",
"internalId": "434",
"fieldType": null
},
{
"valueLookup": {
"type": null,
"name": "Forecast",
"internalId": "1",
"externalId": null
},
"value": null,
"scriptId": "custentity_atlas_pbcs_category",
"internalId": "131",
"fieldType": null
},
{
"valueLookup": null,
"value": "Vendor for the Construction Materials",
"scriptId": "custentity_vendor_description",
"internalId": "437",
"fieldType": null
}
]
},
"currencyRecord": {
"type": null,
"name": "US Dollars",
"internalId": "2",
"externalId": null
},
"currencyList": {
"vendorCurrency": [
{
"currencyRecord": {
"type": null,
"name": "INR",
"internalId": "1",
"externalId": null
}
},
{
"currencyRecord": {
"type": null,
"name": "US Dollars",
"internalId": "2",
"externalId": null
}
}
],
"currencyRecord": null
},
"creditLimit": null,
"companyName": "Pyramid Construction Inc.",
"category": {
"type": null,
"name": "Supplies",
"internalId": "4",
"externalId": null
},
"bcn": null,
"addressbookList": {
"replaceAll": null,
"addressbook": [
{
"label": "2334 N. Michigan Avenue, Suite 1500",
"isResidential": null,
"internalId": "29789",
"defaultShipping": true,
"defaultBilling": true,
"addressbookAddress": {
"zip": "60601",
"state": "IL",
"internalId": null,
"country": "_unitedStates",
"city": "Chicago",
"attention": null,
"addrPhone": null,
"addressee": "Pyramid Construction Inc.",
"addr3": null,
"addr2": null,
"addr1": "2334 N. Michigan Avenue, Suite 1500"
}
}
]
},
"accountNumber": null
}
]
}
}