Attempting to set the price sublist of an inventor...
# ask-stanley-ai
p
Attempting to set the price sublist of an inventory item in the POST request of a Suitelet, but the value isn't saving. Are there known issues or complications to setting the price sublist?
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you're encountering an issue with setting the price sublist of an inventory item in the POST request of a Suitelet. This is a common issue when dealing with dynamic record handling in SuiteScript. The error message you're seeing,
SSS_INVALID_SUBLIST_OPERATION
, typically occurs when you're trying to manipulate a sublist or line item that doesn't exist or is static. In your case, it seems like you're trying to set the price level sublist of an inventory item, which is a dynamic operation. Here's a potential solution: Instead of using
setCurrentSublistValue
, try using
setCurrentMatrixSublistValue
. This method is specifically designed for setting values in matrix sublists, which is what the price level sublist of an inventory item is. Here's an example of how you might use it:
Copy code
javascript
newItem.selectLine({ 
    sublistId: 'price1',
    line: 1
});
newItem.setCurrentMatrixSublistValue({
    sublistId: 'price1',
    fieldId: 'price',
    column: 1,
    value: sellpricefield
});
newItem.commitLine({ sublistId: 'price1' });
Remember to replace
'price1'
with the actual ID of your price level sublist, and
sellpricefield
with the actual price you want to set. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.866760254
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846435606
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846191287
Please provide your feedback on this answer.