Script to send email to users with certain roles
What script can I use to send email to one or more role groups?
Thanks,
Staff Response:
You would use EMailUsersEx to send to a list of users, and load(&root/Users[Roles/RoleID="Manager"]) to get a list of users who have the Manager role.
So you would just do something like:
var #users = load(&root/Users[Roles/RoleID="Manager"]) call EMailUsersEx(#users, subject, body, null)
User Response:
If wanted to include more than one roles and also a list of other users? How should I add them to the list?
Staff Response:
You can just add multiple roles like this:
var #users = load(&root/Users[Roles/RoleID="Manager", Roles/RoleID="Accounting"])
...and you can add other users like this:
add load(&root/Users[UserID="xxx"]) to #users
...where xxx is the user ID of the user you want to add. Just repeat that line for each user.