Tennis
Tennis

Reputation: 137

NetSuite SuiteScript 2.0 : getSublistValue() Not Returning Value

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
});

Upvotes: 0

Views: 2071

Answers (2)

Sravan Teja
Sravan Teja

Reputation: 41

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' });

Upvotes: 0

erictgrubaugh
erictgrubaugh

Reputation: 8902

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

Upvotes: 2

Related Questions