using suitescripts how do I change the pricelevel ...
# ask-stanley-ai
m
using suitescripts how do I change the pricelevel on a line item to "Custom"
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To change the price level on a line item to "Custom" using SuiteScripts, you would need to access the line item on the record and then set the price level. Here is a general idea of how you might do this:
Copy code
javascript
var record = nlapiLoadRecord('salesorder', salesOrderId);
var lineItemCount = record.getLineItemCount('item');
for (var i = 1; i <= lineItemCount; i++) {
    record.selectLineItem('item', i);
    record.setCurrentLineItemValue('item', 'price', '-1'); // '-1' is the internal id for 'Custom'
    record.commitLineItem('item');
}
nlapiSubmitRecord(record);
This script loads a sales order record, iterates over each line item, and sets the price level to "Custom". Please note that '-1' is the internal id for 'Custom' price level in NetSuite. Remember to replace 'salesOrderId' with the actual id of the sales order you want to update. Please note that this is a simplified example and may not cover all edge cases. Always test scripts in a sandbox environment before deploying to production.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836820185
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834114254
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833231509
Please provide your feedback on this answer.