We are facing a problem with sending trigger-emails from EXM. We have created a page with a custom HTML form used for meter readings. The business logic is as follows:
- The user receives an email with a link to the meter reading page
- He enters the page
- He enters data related to the reading, along with the meter reading itself
- He submits the form
- An email is triggered to be sent, based on the data he entered in the form
- He is redirected to a different page with
The challenge is to get the entered data from the form submission (3 and 4) to be available for EXM when creating the email (5).
We have on earlier occasions worked around the problem by saving the form data on the contact in the xDB, and making an assumption that the data is correct when EXM accesses it. In this case we cannot use that approach, because the user might enter multiple meter readings within a short period of time (opening up for challenges with timing, data storage, etc.).
After flushing data to the xDB, we currently use the following line of code to send the email through EXM:
Sitecore.Modules.EmailCampaign.ClientApi .SendStandardMessage(new Guid(MessageId), new XdbContactId(contact.ContactId), true);
Is there a better way to trigger the emails using EXM, where it is possible to pass data directly to EXM (i.e. not saving the data to xDB)?