Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Please note that on Saturday, April 18, 2026, at 8:00 PM Pacific Time, our Case Management System will undergo a scheduled maintenance for approximately 15 minutes. During this time, case creation via SuiteAnswers will be unavailable and inbound calls will be routed to Customer Service.
Creating Payments on an Invoice applies the full amount
I've logged a case (and it's now a defect, but that might not be true) about this but thought I would ask here if anyone has found a workaround.
basically, when creating a payment for an invoice using nlapiTransformRecord() the amount values are ignored and the full amount is applied (very bad)
Here is a script:
function OnAfterSubmit(type) { try { var record = nlapiGetNewRecord(); var eobRecord = record; var paymentRecord = nlapiTransformRecord('invoice', '9341', 'customerpayment'); var numItems = paymentRecord.getLineItemCount('credit'); log('numItem: ' + numItems); paymentRecord.setFieldValue(CUST_PYMT_FLD.CUST, '1032'); paymentRecord.setFieldValue(CUST_PYMT_FLD.PYMT, '200.0'); paymentRecord.setFieldValue(CUST_PYMT_FLD.CHKNUM, 'ABC123'); paymentRecord.setFieldValue(CUST_PYMT_FLD.PYMT_METHOD, '2'); paymentRecord.setFieldValue(CUST_PYMT_FLD.TRANDATE, nlapiDateToString(new Date()) ); paymentRecord.setFieldValue(CUST_PYMT_FLD.AUTO_APPLY, 'F'); paymentRecord.setFieldValue('department', '2'); if(numItems != null && numItems > 0) { log('setting line item'); paymentRecord.setLineItemValue('credit', 'credtotal', 1, '100.0'); paymentRecord.setLineItemValue('credit', 'credapply', 1, 'T'); } nlapiSubmitRecord(paymentRecord, true); log('done submitting'); } catch(err) { //logException(err); nlapiLogExecution('DEBUG', 'Error Value' , err); } } var CUST_PYMT_FLD = { CUST : 'customer', SALES_DIV : 'sales division', IDUNNO : 'undepfunds', APLD : 'applied', AUTO_APPLY : 'autoapply', CHKNUM Steve Klett | Senior Developer
NetValue Technology
0