Home | Cool ClickDimensions Features | Guest Post: Send Email with Custom Entity Data via Workflow

Guest Post: Send Email with Custom Entity Data via Workflow

With ClickDimensions it has long been possible to send an email and include dynamic data from another related system or custom entity. This process is described here. It relies on creating a Connection record to link the other entity record to the Email Send.

It has also long been possible to send a ClickDimensions email from a CRM workflow. This is described here, and involves using workflow to create a special record, a “Send ClickDimensions Email” record.

The challenge is when you need to do both: kick off a ClickDimensions email via workflow and include data from a custom related entity in the email. The solution as described by our guest blogger, is to create an Email Send record from the workflow, create a Connection to the Email Send from your custom entity, and (the most important ingredient) use a custom workflow assembly to associate the recipient’s Contact record to the Email Send. The rest just depends on having the placeholders for the dynamic data in the email template.


Mark Purnell, Technical Sales Architect at Neudesic, describes how to use a custom workflow assembly to accomplish this, and has graciously provided sample code and a solution file:

When developing workflows using the ClickDimensions functionality, you may run into a situation where you need to create an Email Send record in order to initiate a ClickDimensions email instead of the ‘Send ClickDimensions Email’ record. This would happen if you need to merge custom entity attributes to your email as outlined in the ClickDimensions blog at http://blog.clickdimensions.com/2011/10/merge-any-custom-or-standard-entity-data-into-clickdimensions-emails.html

The ‘Send ClickDimensions Email’ record cannot be used to associate a contact to the Email Send record created by the workflow in this scenario. We needed a way to associate the Contact to the Email Send record (which has a N:N relationship to the Contact entity). Since creating an N:N relationship between records is not an out-of-the-box capability, this workflow assembly will allow you to create an N:N relationship between a Contact record and an Email Send record that has been created as a part of the workflow.

To Install:

Download the CustomWorkflow_1_0_0_0.zip solution file at the end of this article and install it by importing it into the solution are in the target CRM instance. Once the solution has been installed, you will see a new step type available in the Workflow Editor called “CustomWorkflow.AssociateContacttoEmailSend”. (NOTE: The solution available below is for CRM 2013 SP1 and higher. You can download the source code and modify it according to the Microsoft CRM SDK for use in CRM Online.)

image

To Use:

  1. You will need to first create the Email Send record in one of the first steps of your workflow.
  2. Once the Email Send record is in context of the workflow, you can now create the N:N workflow step.
  3. Click on the ‘Set Properties’ button to display the Custom Step Input properties page.
  4. In the ‘Contact’ field, you want to identify the contact that you want the Email Send to be sent to.
  5. In the ‘Email Send’ field you will want to identify the Email Send record that was created within the workflow. (Hint, this will be way down at the bottom of the “Look For:” option set underneath the ‘Local Values’ group. The value you will see is the descriptive name of the step that you entered that created the Email Send within the workflow.)image
  6. If you are working with a custom entity and you want any of the attributes on that entity to appear in your email, you will want to add a “Create Record” step to bind the custom entity record to the Email Send record using a Connection record. (Hint, you will want to identify both sides of the relationship in your Connection.)
  7. Finally, in order to send the record off to ClickDimensions, you need to add a Change Status step and choose the workflow step that created the Email Send record to change that record to Outbox status.

NOTE: The sample below works to associate a Contact record with an Email Send from a workflow in CRM 2013 SP1 and higher. The code can be modified for use with Leads and Accounts if they are the intended recipients in your scenario.

Download the solution for CRM 2013 SP1 and higher here. (Note: After downloading the file, right-click it and select “Properties”. You may have to click “Unblock” on the file’s properties to make sure your computer permits you to use the file.)

Sample code is here.

Note: Workflows are Dynamics functionality and, as such, ClickDimensions cannot provide support on this functionality. Please contact your CRM administrator or partner if you need assistance. 

About the Author:

Matt Wittemann is a 13-time Microsoft Dynamics CRM MVP and ClickDimensions' Senior Director, Pre-Sales Consulting.

2 Comments

  1. Uday October 9, 2018 at 4:09 pm - Reply

    Matt,

    From the above steps

    7. Finally, in order to send the record off to ClickDimensions, you need to add a Change Status step and choose the workflow step that created the Email Send record to change that record to Outbox status.

    There is Outbox status value in the current version of ClickDimensions. So, now how to set the email send status to outbox? What is the alternative?

    • mm
      ClickDimensions Marketing October 11, 2018 at 8:51 am - Reply

      Thanks for the question! The “Outbox” status is now labeled as “Scheduled,” so this is what you would choose in the workflow.

Leave A Comment