script to set additional recipients value on new m...
# ask-stanley-ai
n
script to set additional recipients value on new message in UI for emailing invoice
c
AI generated answer (using internal Slack threads):
In SuiteScript 2.0, you can set additional recipients for a new message by manipulating the 'otherrecipientslist' sublist. Here is a sample script:
Copy code
javascript
var rec = currentRecord.get();
rec.selectNewLine({
    sublistId: 'otherrecipientslist'
})
rec.setCurrentSublistValue({
    sublistId: 'otherrecipientslist',
    fieldId: 'email',
    value: '<mailto:example@mail.com|example@mail.com>'
})
rec.setCurrentSublistValue({
    sublistId: 'otherrecipientslist',
    fieldId: 'cc',
    value: true
})
// Commit The Item
rec.commitLine({
    "sublistId": "otherrecipientslist"
});
In this script,
rec.selectNewLine({sublistId: 'otherrecipientslist'})
is used to select a new line in the 'otherrecipientslist' sublist. Then,
rec.setCurrentSublistValue()
is used to set the 'email' and 'cc' fields of the current line. The 'cc' field is set to
true
instead of 'T'. Finally,
rec.commitLine({sublistId: 'otherrecipientslist'})
is used to commit the changes to the line. ****** 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.827518582
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825102448
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818250835
Please provide your feedback on this answer.