0
votes

Unfortunately, it appears that when you create an Invoice from a custom transaction, NetSuite doesn't populate the native 'createdfrom' field. My attempt to work-around the issue by creating a custom reference field (i.e. custbody_invoicecreatedfrom) results in the getSublistValue() function returning an empty result, even through the internal ID is displayed correctly on the apply sublist line of the payment (XML). I tried using getSublistText() as well, but that didn't work either. I have no problem getting the native sublist values (i.e. record browser), but the custom field will not return a value. Any suggestions?

        //Loop through all of the Invoices Applied to the Payment
    for (var k = 0; k < invoiceCount; k++) {

        var invoiceCreatedFrom = paymentSubmitted.getSublistValue({
            sublistId: 'apply',
            fieldId: 'custbody_invoicecreatedfrom',
            line: k
        });
2

2 Answers

2
votes

custbody_invoicecreatedfrom is not a Sublist field, as indicated by the custbody prefix; getSublistValue will only return values from Sublist columns.

0
votes

custbody_invoicecreatedfrom is not a Sublist field, as indicated by the custody prefix then it should be Header field or main field; To get the text from the above filed you need to write code like.

record.getText({ fieldId:'custbody_invoicecreatedfrom' });