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
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