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.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
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