set line item rate to a percent value, not an amou...
# ask-stanley-ai
m
set line item rate to a percent value, not an amount via suitescript
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 set a line item rate to a percent value, not an amount via SuiteScript, you should use the
setSublistText
method instead of
setSublistValue
. The
setSublistValue
method is used for flat rates, while
setSublistText
is used for percentage rates. Here is a sample code snippet:
Copy code
javascript
rec.setSublistText({
    sublistId: 'item',
    fieldId: 'rate',
    text: '20%',
    line: lineCount
});
In this code,
rec
is your record,
item
is your sublistId,
rate
is your fieldId,
20%
is the percentage rate you want to set, and
lineCount
is the line number. Please note that the error message "You have entered an Invalid Field Value 25167 for the following field: item" suggests that the item with internal id 25167 is an invalid choice for your sales order. It could be a classification related error (invalid subsidiary) or perhaps there is no active item with internal id 25167.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.853698552
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842590213
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840606689
Please provide your feedback on this answer.