Sometimes a value is stored on a sublist line that is called “line”. This is usually an integer and sometimes corresponds to the line index (except it is 1-indexed instead). This can cause confusion because it appears to be interchangeable with the index. However, beware, since unintended consequences can arise.
In this particular instance, I believe multiple bills were created at the same time in NetSuite, leading to the following construction:
bill 1, lines 1-100 = line# 1-100
bill 2, lines 1-100 = line# 101-200
etc.
In my use case, I was attempting to retrieve the line on a bill that corresponded to an amortization schedule. The amortization schedule contained a line ID in a field called 'tranlineid', which did not correspond with the line index.
const lineIdString = scheduleRec.getValue({//find the tranlineid from the amortization schedule
fieldId: 'tranlineid',
})
const billLineNumber = billRec.findSublistLineWithValue({//find the real index using this method
sublistId: 'expense',
fieldId: 'line',
value: lineIdString
});
The trick is to treat the “lineid” value as a normal value in a field, which can then be searched for using the findSublistLineWithValue() function.
We like to update our blogs and articles to make sure they help resolve any troubleshooting difficulties you are having. Sometimes, there is a related feature to enable or a field to fill out that we miss during the instructions. If this article didn't resolve the issue, please use the chat and let us know so that we can update this article!
If you have general questions about SuiteCommerce or more specific questions about how our team can support your business as you implement NetSuite or SuiteCommerce, feel free to contact us anytime. Anchor Group is a certified Oracle NetSuite Alliance Partner and Commerce Partner equipped to handle all kinds of NetSuite and SuiteCommerce projects, large or small!
Tagged with Troubleshooting