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.
CustomerPayment being applied as the full amount
I've got a UE script that is transforming an Invoice into a CustomPayment. I'm setting various fields on the payment record including 'payment'.
Although I have set the payment amount to something less than the full amount, when the record is saved it applies the full amount to the Invoice.
Here is the code (trimmed down sample)
/* * This script will handle the client side as well as server side EOB related tasks */ var CUST_PYMT_FLD = { CUST : 'customer', IDUNNO : 'undepfunds', APLD : 'applied', AUTO_APPLY : 'autoapply', CHKNUM : 'checknum', PYMT_METHOD : 'paymentmethod', MEMO : 'memo', PYMT : 'payment', TRANDATE : 'trandate', } function OnAfterSubmit(type) { try { var eobRecord = nlapiGetNewRecord(); var paymentRecord = nlapiTransformRecord('invoice', '9341', 'customerpayment'); 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'); nlapiSubmitRecord(paymentRecord); } catch(err) { logException(err); } } Steve Klett | Senior Developer
NetValue Technology
0