Skip to main content
May 2, 2022
Question

Send email to array of users

  • May 2, 2022
  • 14 replies
  • 0 views

I have a user picker that selects max 3 users. In the process model I want to send the email to all the users in the array of users. 

14 replies

mikes0011
Brainy
May 2, 2022

Can you share what you've already tried and what difficulty you're having?  In general (assuming a valid array of users with valid email addresses) this is usually pretty straight forward, IIRC, because you can just target your user array in the "to:" field of the Send Email node.

The Expression Guru
May 2, 2022

toemailaddress(pv!reportRequest.reviewer)



and the reviewer variable just has the array of users with valid email addresses 

mikes0011
Brainy
May 2, 2022

If pv!reportRequest.reviewer is user type, I don't think you even need to wrap it in toEmailAddress().  That function seems to only be needed when you want to target plaintext email addresses as recipients.  In fact it might be hurting you here, because if you wrap an array of user in this function, it might accidentally be trying to treat their usernames as email addresses, which would definitely not work.  But again I'm not sure since you haven't actually said what's working / not working.

The Expression Guru
May 2, 2022

Hi,

As Mike mentioned it is straight forward implementation. In your process add a process variable of type user (It should be Array type). Then save your selected picker field values/users to this process variable. In your email node call this process variable in TO field using expression editor.

May 4, 2022

Tried this method however script task isn't saving reviewer to selected users 

May 5, 2022

Hi,

if possible con you share your code and screenshots of process configuration. It is difficult to answer whit out knowing what you have done