A user receives the error: SSS_MAXIMUM_NUMBER_RECIPIENTS_EXCEEDED
This error is returned when the “notifySenderOnBounce” is set to True when using Communication APIs and the total number of recipients (recipient + cc + bcc) exceeds 10.
To work around the error, the user can get the count for the recipients first. Then, if the count is greater than 10, you can create a for loop block to send the email per batch of 10.
Sample script:
require(['N/email', 'N/runtime'], function (email, search) {
var count=[
'testa@sample.com', 'testb@sample.com',
'testc@sample.com', 'testd@sample.com',
'teste@sample.com', 'testf@sample.com',
'testg@sample.com', 'testh@sample.com',
'testi@sample.com', 'testj@sample.com',
'testk@sample.com'
];
var total = count.length;
var batch = 10;
for (var i = 0; i < total; i += batch)
{
var receiver = count.slice(i, batch + i);
email.send({
author: runtime.getCurrentUser(),
recipients: receiver,
subject: 'Subject',
body: 'Body',
notifySenderOnBounce: true
});
}
});