How to create a workflow that will send an email containing parts of a record that was just created?

Hello,

I am very new to working in Corteza. I am trying to set up a workflow that Alerts an administrator when a new record is created, and some information within the new record being displayed within the email.

I have a workflow that triggers after creation of a new record which then has a function that sends an email to a specific user but it just says “A new record has been created” essentially. This workflow is working perfectly. However, I want to add content to the body of the e-mail that gets pulled from the new record that is created.

Where would I begin looking into automatically having parts of the record that was created included in the email that is sent so that an administrator can quickly discern some information from the email that is sent to them?

1 Like

I have the same issue. I’m trying to figure out how to add content from the record fields into the body of my email.

You’ll have to use templates, Templates :: Corteza Docs

You can look at the “CRM - Quote - Send To Custom Email” workflow that comes with the default CRM for example usage.

Basically in short:

  1. Create a template with interpolated sections for populating with record variables
  2. Create a workflow that populates the template with record variables and renders email
  3. Send email

We’ve managed to build a template for a workflow we modeled after the “CRM - Quote - Send to Custom Email” example. Our templates preview is exactly how we intended it to look. However, regarding the workflow, we’re facing challenges with the “Compose Records Search” query and integrating the template seamlessly into the workflow. Any guidance on this issue would be appreciated

The workflow that shows how to use the template in such a way is called the same:
“CRM - Quote - Send to Custom Email”

If that is not enough, you’ll have to be more specific.

Hello. I tried using the Workflow - Quote - Send to Custom Email. It works, but the email contains a table without values.


As I understand it, the variables in the email template do not pull the values from the Quote module. How can I fix this?

These steps (like they are named) Get the quote line items, set the variables for the template.
Then they render the template and send it via email.

The steps that prepare and populate the template are the first two in the image, i suggest you take a look at those.

Without knowing more i cannot say why they don’t populate for you. So you’ll have to debug it yourself, i suggest using prompts or debug log to confirm the values are ok in those steps.

Otherwise this is the docs that describe this process
https://docs.cortezaproject.org/corteza-docs/2023.9/integrator-guide/automation/workflows/examples/index.html#_template_rendering

Also, as i can see, your quote is using the variables {{.quote.values.foo}}
That means the renderVariables expect a quote variable passed to them

1 Like

Thank you very much for your answer. I read and tried to use the workflow specified in the link.

My goal is to send lead data (email, phone) via email. I couldn’t achieve this, so I decided to use the quote module, as an email template uses many variables. If I could do it with the quote module, I would repeat it for leads by analogy. So, I created two workflows: sending record data via HTTP (the data arrives in this form)


and sending an email

(a table is received without variable values). I can’t figure out what’s wrong.

Do look at the above docs, as I can see in the screenshot you’re not providing variables to the template therefore it doesn’t populate them.

Look at the workflow I mentioned above, you’ll see the steps.

It gets the record(quote), creates render variables for the template, and provides it to the “Render template” step.