jrd
February 27, 2024, 11:43pm
1
Hi
I would like to build a View to selectively send emails, ie choose recipients by name or role.
I can use system.users.getUsers, but the list does not include email addresses
How do I do this?
system.user.getUsers
returns a list of complex User
objects, which do contain the email address, you just have to work for it a little bit.
E.G. this thread:
Oh yes you're right! It is working perfectly now, I really appreciate it. The final form is:
list = []
users = system.user.getUsers("")
for user in users:
contacts = user.getContactInfo()
for contact in contacts:
if contact.contactType == "email":
email = contact.value
first = user.get(user.FirstName)
last = user.get(user.LastName)
if email is not None and first is not None and last is not None:
list.append((first, last, email))
print list