How do I insert a line in the item sublist on a sa...
# ask-stanley-ai
s
How do I insert a line in the item sublist on a sales order and set the price level with suitescript?
c
AI generated answer (using internal Slack threads):
To insert a line in the item sublist on a sales order and set the price level with SuiteScript, you can use the
selectNewLine
,
setCurrentSublistValue
, and
commitLine
methods. Here is a sample code snippet:
Copy code
javascript
var salesOrderRecord = record.load({
    type: record.Type.SALES_ORDER, 
    id: 'your_sales_order_id',
    isDynamic: true,
});

salesOrderRecord.selectNewLine({
    sublistId: 'item'
});

salesOrderRecord.setCurrentSublistValue({
    sublistId: 'item',
    fieldId: 'item',
    value: 'your_item_id' // replace with your item id
});

salesOrderRecord.setCurrentSublistValue({
    sublistId: 'item',
    fieldId: 'price', // price level field
    value: 'your_price_level' // replace with your price level
});

salesOrderRecord.commitLine({
    sublistId: 'item'
});

var recordId = salesOrderRecord.save();
Please replace
'your_sales_order_id'
,
'your_item_id'
, and
'your_price_level'
with your actual sales order id, item id, and price level respectively. ****** 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.859813631
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851379395
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850718915
Please provide your feedback on this answer.