Hi Netsuite Professionals I am new here and I am e...
# general
m
Hi Netsuite Professionals I am new here and I am entry level netsuite developer and I have question reagarding suitescript I am trying to create one Customerpayment from multiple invoices in suitescript 2 but it throws error "An unexpected SuiteScript error has occurred" Here is my Suitescript try { var invoiceId = 703778; // ID of the invoice for which payment is being made var paymentMethod = "1"; // Payment method (e.g. 'creditcard') var invoiceTotal=130.22; // Handle form submission var customerId = 16568; var payment = record.create({ type: record.Type.CUSTOMER_PAYMENT, isDynamic: false }); payment.setValue({ fieldId: 'customer', value: customerId }); payment.setValue({ fieldId: 'autoapply', value: false }); payment.setValue({ fieldId: 'trandate', value: new Date() }); payment.setValue({ fieldId: 'paymentmethod', value: paymentMethod // 1 = Check payment method }); payment.setSublistValue({ sublistId: 'apply', fieldId: 'internalid', value: invoiceId, line:1 }); payment.setSublistValue({ sublistId: 'apply', fieldId: 'amount', value: invoiceTotal, line:1 }); var paymentId = payment.save(); return paymentId; } catch( e ) { log.debug( { 'title': 'error', 'details': e } ); return { 'error': { 'type': e.type, 'name': e.name, 'message': e.message } } }
r
The internalid of the payment should not be that of the invoiceid. Let it be unique and the system drive it. Are you getting the stack trace from your log.debug details? Also, #C29HQS63G is the right channel for this.
m
Thank you for reply, I posted in suitescript channel and I traced logs and log says error at setSubListValue function, I am wonder why this setSubListValue is not supported
r
I bet it's the internal id