Question

Photo of Jeremy Turgeon

0

Send Multiple Emails In Workflow

Can the Send Email or Send SMS action in workflows have multiple values entered?  I'm trying to send to 100+ addresses that are not connected to person records but would rather not create 100+ actions.

  • Photo of Trey Hendon III

    0

    Looking in the code, there is supposed to be a way to feed a comma seperated list to the "to" address.  However, I've not been able to get it to work yet.

    • Derek Mangrum

      Yes, this is what I am doing, and it works fine. But, I can't get the Send Email Action to work when targeting an Attribute of type Group. :/

    • Derek Mangrum

      I do not get an error when I use the 'Send Email' action and send to a comma-delimited list of smtp addresses. It is a bit touchy and you have to make sure that the list is well-formatted. That is, no leading or trailing commas, etc. The code doesn't look like it is doing many/any checks, but may be getting a tune-up in the not-too-distant future to do a few of these checks. But, with a well formed list, this function works fine for me.

    • Trey Hendon III

      Derek is totally right! We worked together today and found that my problem was the way the Lava merge was being evaluated in my SQL statement. I'm good to go now!

    • Arran France

      I'm going to go ahead and mark this as answered. Jeremy, feel free to comment back if this still isn't working (but I'm sure it is ;))

  • Photo of Trey Hendon III

    0

    Here is a SQL Action I'm using to build a string of comma seperated emails of just relative group leaders, maybe it can get your creative juices flowing.  I'm setting the return of this SQL to my attribute GroupLeadersEmails and using that Attribute as the To Address.  You could do something similar for yours.  NOTE, all recepients will see each other's email addresses using an email send in this manner.

    SELECT DISTINCT substring((
                SELECT ',' + p1.Email AS [text()]
                FROM GroupMember gm1
                JOIN Person p1 ON gm1.PersonId = p1.Id
                WHERE gm1.GroupId = gm.GroupId
                    AND gm1.GroupId LIKE '{{ Workflow.Group }}'
                    AND gm1.GroupRoleId = 39
                    AND ISNULL(p1.Email, '') <> ''
                ORDER BY p1.LastName
                FOR XML PATH('')
                ), 2, 1000) [Emails]
    FROM GroupMember gm
    JOIN Person p ON gm.PersonId = p.Id
    WHERE GroupId LIKE '{{ Workflow.Group }}'