Sending transactional mails

This topic is for administrators and developers with administration access rights in Microsoft Dynamics.

This topic describes how to send transaction mails An email triggered by a recipient action (such as an order or purchase) or event (such as an anniversary). It is sent out subsequent to the event. in Optimizely Campaign from Microsoft Dynamics CRM using a workflow in CRM. After sending, response data (opens, clicks) are automatically transferred into CRM.

Prerequisites

  • Configuration of the integration completed, see Configuration.
  • Campaign mailing prepared in Optimizely Campaign.
  • The ID of the campaign mailing to be sent. You can find the ID under Transactional mails in Optimizely Campaign. Select the column ID in the drop-down list to the right.
  • The authorization code of the recipient list used by the transactional mailing.

Configuring transactional mailings and workflows

Before sending a transactional mailing from Optimizely Campaign, you need to configure the transactional mailing in Microsoft Dynamics CRM. You can send these mailings to contacts, accounts or leads even without advertising consent. You also need to define a workflow to trigger the transactional mailing.

Configuring the transactional mailing

  1. Open Microsoft Dynamics CRM and select Settings > Configurations.

    Image: Configurations

  2. Click New.
  3. Enter a name for the configuration.
  4. In the Value field, define the configuration using an XML format. The fields <authCode> and <bmMailingID> are mandatory.

    For <authCode>, enter the authorization code for the transactional mailing's recipient list. For <bmMailingId>, enter the mailing ID of the transactional mailing.

    Other fields can be optionally linked, as long as the information is available in CRM.

    <root>
    <authCode>authorization.Code</authCode>
    <bmMailingId>mailing.ID</bmMailingId>
    <firstname>object.firstname</firstname>
    <lastname>object.lastname</lastname>
    <salutation>object.salutation</salutation>
    </root>

    When sending from another entity except contact, lead or account, a lookup references to the connected bmRecipientId. Furthermore, data fields in contact, lead or account are integrated via lookups.

    <root>
    <authCode> Authorisierungs-Code </authCode>
    <bmMailingId> Mailing-ID </bmMailingId>
    <bmRecipientId>object.new_exampleentityfor.emailaddress1</bmRecipientId>
    <dynamicsId>object.new_exampleentityfor.contactid</dynamicsId>
    <first_name>object.new_exampleentityfor.firstname</first_name>
    <last_name>object.new_exampleentityfor.lastname</last_name>
    </root>

    You can find the name of the lookup element that is inserted between the object and the field name (for example, contactid) in the Fields overview. Search for the name of the field in which the lookup for contact, lead, or account is performed. In the example, the name is new_exampleentityfor.

    Image: Lookup in Fields

  5. Click Save & Close.

    Image: Save & Close

The configuration can be updated and saved if needed.

Configuring the workflow

  1. Open Microsoft Dynamics CRM and select Settings > Processes.

    Image: Processes

  2. Click New.
  3. Enter a name in Process name.
  4. Under Category, select Workflow.
  5. As Entity, select Contact, Lead or Company.
  6. Keep the selection Run this workflow in the background.
  7. Select New blank process, if you are not using an existing workflow as template,
  8. Click OK.

    Image: Create process dialog box

  9. Under Activate As define if the workflow is to be created as process or as template.
  10. Under Available to Run, select the dependencies of the process. For manual start, select As an on-demand process.
  11. Under Workflow Job Retention, define if the workflows should be automatically deleted after completion.
  12. Under Options for Automatic Processes, define who can start the process.
  13. Under Start when, define which action should trigger automatic dispatch. If nothing is selected, the dispatch is started manually in CRM.
  14. Select Add Step > Episerver Campaign > Send Transaction Mail.

    Image: Send Transaction Mail

  15. Click Set Properties.
  16. In the Value column, search for and select the previously created configuration.

    Image: Locate configuration

  17. Click Save and Close.

Checking return values of the process

You should add error handling steps, configuring how the process should handle different return values of incorrectly sent transactional mails. Transactional mailings are sent using the sendtransactionmail operation of the HTTP API. Here is an example for canceling an unsuccessful process.

  1. In the Process window in Microsoft Dynamics CRM, click Add Step > Check Condition.
  2. Click <condition> (click to configure).
  3. Click Select.
  4. Click Send Transaction Mail.
  5. Click Service Response in the second drop-down list.
  6. Click Does Not Begin With in the third drop-down list.
  7. Click Enter value and enter the return value enqueued.
  8. Click Save and Close.

    Image: Check conditions

  9. Click Select this row and click Add Step.
  10. Select Add Step > Stop Workflow.
  11. Select Canceled in the status drop-down list.
  12. Image: Stop workflow

  13. Click Set Properties.
  14. Click in the Value column.
  15. In the drop-down list, select Look for:> Send Transaction Mail.
  16. In the drop-down list, select Service Response.
  17. Click Add.
  18. Click OK.
  19. Click Save and Close.

    Image: Service Response

  20. Under Process in the menu bar, click Convert to a real-time workflow.
  21. Click Activate, and Activate in the Process Activate Confirmation dialog box.
  22. In the Process window, click Close.
  23. Image: Save and Close

Send out transactional mailing

The workflow is now fully created, activated and starts according to the preconfigured action or may be triggered manually. A transaction mailing is started manually from the entity specified in the process.

  1. Select Run Workflow in the entity.

    Image: Run workflow

  2. The Lookup Record dialog box opens. Select the workflow of the transaction mailing and click Add.

    Image: Lookup Record dialog box

  3. The dialog box Confirm Application of Workflow opens. Click OK.