We’ll walk through setting up an email that is sent by an automation when a SFDC object has a checkbox that is checked. Once the email is sent from Marketing Cloud we’ll flip the object’s checkbox back to un-checked. This method is “triggered” in the sense that checking a checkbox in Salesforce will cause the email to send, this will not use a Marketing Cloud Triggered Send Definition.
This type of automation provides a quick and easy way to send Marketing Cloud emails from Salesforce without having to login to the Marketing Cloud.
To do this you will need to have your Salesforce account connected to Salesforce Marketing Cloud using Marketing Cloud Connect. You will also need to have the object you would like to use setup as a synchronized data extension.
- Add a new checkbox to your object, for this example we’ll be using the Contact object and a checkbox field named “Resend Welcome Email”.
- In Contact Builder, edit the fields on the Contact data source to add the new checkbox field to the Contact object’s synchronized data extension.
- Create a new Salesforce Data Extension with Contact/Lead ID, Email Address, and any other personalization fields you may need for the email. Make this data extension sendable and map the ID field to Subscriber Key.
Name Type Length Nullable Primary ContactID Text 18 Checked EmailAddress FirstName Text 40 Checked
- Create a query activity to query subscribers that have their checkbox checked from the synchronized data extension into the data extension that was created in step 3. Be sure to set the query to overwrite.
SELECT Id AS ContactID, Email, FirstName FROM [Name of Synchronized Data Extension] WHERE Resend_Welcome_Email__c = ‘true’
- Create your email then use the UpdateSingleSalesforceObject() AMPscript function to flip the subscribers flag back at the time of send. Place the function at the bottom of your email, don’t forget to wrap the function in AMPscript open/close tags: %%[ ]%%
%%[ UpdateSingleSalesforceObject("Contact",ContactID,"Resend_Welcome_Email__c","false") ]%%
- Send Preview and/or validate the email to ensure there are not any scripting errors.
- Create a Scheduled Automation to run your query activity, a validation activity (no point in running the send if there are no subscribers to send to), then your send email activity. Schedule this automation to your desired cadence.
Note: depending on your synchronized data extension poll schedule settings it may take some time for the checkbox changes to be synchronized to your Marketing Cloud account.
Viola! You now have an email that will be sent to Contacts that have a checkbox checked in Salesforce. At the time of send, Marketing Cloud will flip the checkbox back to unchecked.