When certain actions happen in your Creatio site, you may need to trigger an email alert letting someone know about that action. Sending the email message is a pretty simple configuration as part of a Dynamic Case or Process. 

Steps on triggering an email

Typically, within that email message, you want to include details about the action or the record involved. To do this, you’ll need to create an email template and include Macros for the data that you want to embed. 

To create an email template, go to the ‘Message templates’ section – you can find this by default in the Studio workplace, and it can be added to other Workplaces as needed. 

Create a template via the sidebar options

When creating your email template, it’s important to set the ‘Macro source’ to the object whose data you’re including in the template. For example, if my triggering action is the status change of an Account, and I want to include Account data in my report, my ‘Macro source’ would be Account. 

Select the correct template

Once you’ve set your Macro source, when editing your template, you can easily embed data from that object using the Macro button and the ‘Custom macro’ option. 

Embed data easily by customizing it

This will present you with a list of all of the data columns in your Macro source object, and you can easily select from that list to embed data. There’s also a list of ‘Related Objects’ where you can pull data in from a related object connected to your Macro source object. However, you might notice that not every related object appears in this list. For example, Contacts is not listed as a related object for the Account object. 

List of all the data example

Why are some related objects listed and not others? It depends on the type of relationship. An Account has a single Parent Account, so that relationship is included in the list – there’s an unambiguous, single value to use for the email template. On the other hand, an Account can have many Contacts – so it’s not an option in the template builder as the email template wouldn’t know which contact’s data to include.

Unlike the MS Word reports function, email templates in Creatio do not currently support child tables. So, if you need to include data from a child object in an email template, where does that leave you? I recently received such a request. After some experimentation, this is how I worked around the limitation: 

  1. In the parent object (Account, in this example), I created an unlimited length text field. This field does not need to be displayed on the parent object’s page, we are just going to use it to deliver data to the email template. 
  2. Next, we need to populate data into the field. I chose to do this as part of my process, before sending the email. More details on how to do this are below. You could also potentially do it via a separate business process triggered by data creation/update in the child table. 
  3. Finally, in my email template, I pull in that text field. Since it’s a field in the parent object, this works just like any other custom macro.

Here’s step 2 in a bit more detail since that’s the part of this with a bit of technical difficulty. 

In my case, I needed to compile data about all of the Contacts for the Account, such as their name and email address. In order to do that, first I’m using a Read Data element to read the collection of contacts for the Account. You can do that by changing the mode in the Read Data element from the default ‘Read the first record in the selection’ to use ‘Read collection of records’ instead. Then, I’ve identified which Contacts I want to pull into my collection – in this case, all Contacts for the triggering Account.

Compile all contacts information

Then, I’m passing that collection to a loop that adds each contact’s data, one by one, into a text parameter. Please see this blog for the details on how to loop through data within a process. 

Collection passes through a loop of each contact

Finally, I’m saving that text parameter’s value to the text field I created in step 1, so the collected data will be available to use when sending the email.  Once the data is saved, I can then send the email. 

Saved data that is ready to use for email
Posted in:

Looking for Creatio help?

We do training, customization, integration, and much more. Contact us today.