36 réponses
Forum Ambassador Michael Brown (Salesforce)
Hey Courtney,
Yeah, unfortunately if you're saving the results of a record choice set in a variable, it will only show the last selected value. As far as your email alert, it's giving that error because the email alert is built on the Opportunity object and is therefore expecting an opportunity id from which to send the email, and a contact id being passed in.
I did some playing around on my end, and I think there are two options to best handle this.
1. Send emails directly from flow without Email AlertsIn this option you would send emails directly from flow and would ultimately go away from your email alerts. The upside is that it should be easier to work with multiple contacts, but the downside is that you won't be able to leverage your existing email templates. The logic for this would work as follows:
- Your flow would be the same up until your decision element
- Your Decision element would direct users to the appropriate Send Email action, rather than an Email Alert action
- Send Email actions let you configure the recipients and body of the message. For the Email Addresses, you could reference your multi-select picklist component as the comma separated email addresses. In the Rich-Text Formatted Body, you could use a Text Template with the contents of your email
2. Use a Contact Email Alert
In this option, you can continue using email alerts, but you have to reconfigure them on the Contact object. Since we would be passing in the ids of each of the contact selected, the email alert would be sent to each of those contacts. The upside here is that you can use email alerts to send the message, but the downside is that you need to recreate them on the contact object, you would notbe able to reference information about the Opportunity, and we need to create a collection of contact records from your multi-select picklist fields, which is more challenging. The logic for this would work as follows:
- When a user selects contacts in your flow, it stores that in one long string, witch each id separate by a semi-colon
- You could have the flow parase through this string, and add the contact id to a collection variable. For example, let's say I selected two contacts. The multi-select picklist will look something like this 003000000000123; 003000000000456. We would parse through this string and store each id in a collection variable
- Once the collection variable is populated, your decision element could then route the flow to a loop, depending on the email selected. The loop would then loop through this email and call the Email Alert action, passing in the contact id for each contact in the collection variable.
To recap, these are the pros and cons of both options. Let me know which one you're leaning towards, and I can help better mockup how that would work
Option 1:
Pros- Easier to configure
- Email can use merge field data from both Contact and Opportunity
- Cannot use email alerts/email templates; these would be recreated as text templates within the flow
- If wanting to update the email message, you would need to update the flow directly since there are no email templates
Option 2:
Pros- Can use email alerts/email templates to control the messaging
Cons- Email cannot use merge fields to pull in data from the Opportunity object
- Existing email alerts would have to be repurposed for the contact object
- Additional flow complexity to create a collection variable from a multi-select picklist
Thanks,
Mikey