Created
January 10, 2024 17:53
-
-
Save nicolasmelo1/eaf6d126d3b91e67d0c9bbc5110c0560 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var customerRefund = nlapiCreateRecord('customerrefund'); | |
customerRefund.setFieldValue('customer', '111736'); | |
customerRefund.setFieldValue('currency', '1'); | |
customerRefund.setFieldValue('account', '217'); | |
customerRefund.setFieldValue('trandate', new Date()); | |
customerRefund.setFieldValue('paymentmethod', '14'); | |
const creditCount = customerRefund.getLineItemCount('apply'); | |
const creditMemoIndex = customerRefund.findLineItemValue('apply', 'internalid', '4498596'); | |
console.log(creditMemoIndex) | |
for (let record = 1; record <= creditCount; record++) { | |
if (customerRefund.getLineItemValue('apply', 'internalid', record) == '4498596') { | |
customerRefund.selectLineItem('apply', record); | |
customerRefund.setCurrentLineItemValue('apply', 'apply', 'T'); | |
customerRefund.commitLineItem('apply'); | |
break; | |
} | |
} | |
var customerRefundId = nlapiSubmitRecord(customerRefund, false, true); | |
console.log(customerRefundId); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment