Is there a way to use `N/email` to send to a NetSu...
# suitescript
r
Is there a way to use
N/email
to send to a NetSuite group directly? The group does not have it's own email, just a collection of employees. I tried putting the internal id of the group under
Nemail.send({recipieints: <group internalid>})
, however NetSuite just throws an
UNEXPECTED_ERROR
. I know I can separately get the group, get the members, loop over members and add as individual recipients to
Nemail
, just seems like re-inventing the wheel when the group already exists. Making sure I'm not missing something about being able to send directly to a group.
e
You can get the group members id and push them into an array and use that array in the recipients field.
r
so still requiring a separate lookup for the group members. ok.
e
@Rick Goodrow I can confirm this. Feels like you should be able to pass in a group id, but you cant. You need to do a search to find members of the group and send the emails using their Employee Internal IDs One thing to look out for is that you also need to "chunk" the IDs into 10 because
email.send
only supports 10 email addresses at a time
r
yea. I'm writing my own library function
sendToGroup(emailParams)
to handle it. Take a group ID, run a saved search, parse results, chunk sending if necessary
👍🏻 1