ANS-1484 · SUITESCRIPT DEVELOPMENT

How to Resolve SSS_MISSING_REQD_ARGUMENT for Item Pricing Sublists

When scripting item pricing in NetSuite with multiple currencies enabled, an SSS_MISSING_REQD_ARGUMENT error can occur when dynamically constructing sublist IDs.

Short answer

The SSS_MISSING_REQD_ARGUMENT error, encountered when dynamically constructing sublist IDs for item pricing in SuiteScript, can be resolved by using the concat() function instead of the + operator for string concatenation. This ensures the sublistId argument is correctly passed to functions like getLineCount.

Scenario

NetSuite environments with the 'Multiple Currencies' feature enabled utilize separate pricing sublists for each currency on the 'Sales/Pricing' tab of item records. When attempting to programmatically access or manipulate these pricing sublists via SuiteScript, particularly when dynamically constructing the sublist ID (e.g., "price" + currency internal ID), a SSS_MISSING_REQD_ARGUMENT error may occur. This error indicates that the sublistId argument is not being correctly recognized by SuiteScript functions like getLineCount, affecting both dynamic and standard mode records.

Solution

The internal ID for each currency pricing list is structured by concatenating the base 'price' ID with the currency's internal ID. For example, the internal ID for the USA currency (internal ID 1) would result in 'price1'. Earlier SuiteScript examples might have demonstrated accessing these lists as follows:

javascript
priceID = "price";
var internalId = nlapiSearchRecord('currency', null, new nlobjSearchFilter(
'symbol',
        null,'contains', currencyID))[0].getId();
priceID = priceID + internalId;
// ...
itemRecord.selectLineItem(priceID, 1);
itemRecord.setCurrentLineItemMatrixValue(priceID, 'price', 1, basePrice);
itemRecord.commitLineItem(priceID);

However, when attempting to dynamically construct the sublistId in SuiteScript 2.0 using the + operator, as shown below:

javascript
var priceID = "price";
var currency = salesOrderRecord.getValue({
 fieldId: 'currency'
});
priceID = priceID + currency;
// ...
var itemCount = itemRecord.getLineCount({
 sublistId: priceID
});

This can lead to an SSS_MISSING_REQD_ARGUMENT error:

json
"name":"SSS_MISSING_REQD_ARGUMENT",
"message":"DeferredDynamicRecord.getLineCount: Missing a required argument: sublistId"

In this specific context, it was found that using the concat() function instead of the + assignment operator for the pricing list ID resolved the issue.

The corrected approach for constructing the sublistId is:

javascript
priceID.concat(currency)

This ensures the sublistId is correctly passed to SuiteScript functions.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant