in a client script, how can I access the item Opti...
# ask-stanley-ai
e
in a client script, how can I access the item Options a user selected after adding a line to the sales order
c
AI generated answer (using internal Slack threads):
In a client script, you can access the item options a user selected after adding a line to the sales order by using the
getSublistValue
method. This method allows you to retrieve the value of a sublist field on a record. Here is an example of how you can use it:
Copy code
javascript
var optionValue = rec.getSublistValue({
    sublistId: 'item', 
    fieldId: 'options', 
    line: 0
});
In this example,
rec
is the record instance,
item
is the sublistId,
options
is the fieldId, and
0
is the line number. This will return the value of the 'options' field for the first line of the 'item' sublist. If you want to get the value of a custom item option, you need to find its scriptId and use that as the fieldId. For example:
Copy code
javascript
var customOptionValue = rec.getSublistValue({
    sublistId: 'item', 
    fieldId: 'custcol1', 
    line: 0
});
In this example,
custcol1
is the scriptId of the custom item option. ****** 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.846801579
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829153836
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827807128
Please provide your feedback on this answer.