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.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
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