Global API
...
Requests
Customer Payment
Update
1min
the following is an example of update customer payment where we are changing some of the fields (see https //app archbee io/docs/ lihuunv 7xnqrtzhskkc/fgc9eqdmrkfq6ct2cri5h customer payment docid\ l s8ofal1497wkapqkulh for all available fields) the netsuite customer payment id (internalid) is required to update the customer payment note you can only update one record at a time the response returns the complete customer payment information, but we have shortened the response in our example for ease of reading request //create a map to store all the data of a payment map\<string, object> nscustomerpayment = new map\<string, object>(); 	nscustomerpayment put('internalid', '97006'); 	nscustomerpayment put('classification', new map\<string, object>{'internalid'=>'2'}); nscustomerpayment put('department', new map\<string, object>{'internalid'=>'1'}); nscustomerpayment put('memo', 'payment 25 update'); nscustomerpayment put('trandate', datetime newinstance(2020, 11, 07) gettime()/1000); nscustomerpayment put('payment', '91000'); // apply only to approved status containing invoices and having same customer as payment list\<object> paymentapplylist = new list\<object>(); map\<string,object> apply = new map\<string,object>(); apply put('doc', '97807'); apply put('line', '0'); apply put('apply',true); paymentapplylist add(apply); nscustomerpayment put('applylist', new map\<string,object>{'apply'=>paymentapplylist,'replaceall'=>false}); // initializing the payment custom fields list\<object> paymentcustomfieldlist = new list\<object>(); map\<string,object> paymentcustomfield = new map\<string,object>(); paymentcustomfield put('fieldtype', 'select'); paymentcustomfield put('scriptid', 'custbody customlist'); paymentcustomfield put('valuelookup', new map\<string,object>{'internalid'=>'1'}); paymentcustomfieldlist add(paymentcustomfield); // adding the payment custom fields nscustomerpayment put('customfieldlist', new map\<string,object>{'customfield'=>paymentcustomfieldlist}); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('customerpayments', new list\<object>{nscustomerpayment}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'updatecustomerpayment'); 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=updatecustomerpayment, timestamp=1648456133269, validrequest=true, version=1 0, responsejson={ "errors" \[], "status" "200", "customerpayments" \[ { "undepfunds"\ true, "unapplied" 0 0, "tranid" "117", "trandate" 1604638800, "subsidiary" { "type"\ null, "name" "parent company", "internalid" "1", "externalid"\ null }, "status" "not deposited", "salesforceid" "a0l1m000003ee6peas", "payment" 91000 0, "memo" "payment 25 update", "location" { "type"\ null, "name" "test atlanta west", "internalid" "1", "externalid"\ null }, "lastmodifieddate" 1648456129, "internalid" "97006", "externalid"\ null, "exchangerate" 1 0, "department" { "type"\ null, "name" "pr department", "internalid" "1", "externalid"\ null }, "customform" { "type"\ null, "name" "custom customer payment", "internalid" "105", "externalid"\ null }, "customfieldlist"\ null, "customer" { "type"\ null, "name" "cust871at infosys", "internalid" "63587", "externalid"\ null }, "currencyname" "us dollars", "createddate" 1648453996, "classification" { "type"\ null, "name" "individual partner class", "internalid" "2", "externalid"\ null }, "applylist" { "apply" \[ { "type" "invoice", "total" 91000 0, "refnum" "inv454", "line" "0", "due" 91000 0, "doc" "97807", "currencyvalue" "us dollars", "applydate" 1648440000, "apply"\ true, "amount" 91000 0 } ] }, "applied" 91000 0 } ] } }