Using Query Result as Email Body

Hello! I've created a workflow that is supposed to summarize our Domo credits used in the previous month by user, then send each user an individualized email reporting what they've used. The query seems to run fine, but when I Send Email To Person the body of the email shows all null values for the dynamic fields. I think I'm defining the objects incorrectly, but I'm not sure. Has anyone resolved this for themselves?

Screenshot 2025-04-22 152218.png
Tagged:

Answers

  • vtiwari
    vtiwari Domo Employee

    Hi @EmilyRho_s These might help you. Please see the following and review it.

    1. Check Field Names (Case-Sensitive)

    Make sure the dynamic fields you're referencing in the email (e.g., {{CreditUsed}}, {{UserName}}) exactly match the column headers in your dataset. Domo is case-sensitive, so username and UserName are different.

    2. Confirm Input to the "Send Email to Person" Action

    Double-check that each row in your dataset (or dataset used in a DataFlow or Magic ETL) has the correct data populated before the email step. The “Send Email to Person” step acts per row — if fields are null there, it's likely they weren't populated upstream.

    3. Output Object from Previous Action

    Look at what the previous action is sending into the “Send Email” step. If you're using a dataset in a Magic ETL or Workflow, verify that:

    • The object passed to the email action includes the expected fields.
    • You're using the correct syntax in the email body like {{field_name}}.

    4. Testing Tip: Use a "Write to Dataset" Step

    Before the email, insert a "Write to Dataset" step to log the fields you're expecting to send. That way, you can see exactly what each row looks like just before the email is sent.

    5. Sample Email Body Syntax

    Your email body should look like this:

    CopyEditHello {{UserName}},You used {{CreditUsed}} Domo credits in the past month.Best,The Team
    

    Make sure UserName and CreditUsed are exactly the field names passed to this step.

    Let me know if this helps you and get the desired output.

  • Thanks for the suggestions, vtiwari!

    The Workflow looks pretty different now, but here are the biggest fixes that helped me:

    1. Moved the loop. The conditional logic needed to be before Filter By User (getObjectFromList) to correctly get one object from the list of objects.
    2. Added Child Properties to individualUsage that matched lastMonth. The SQL statement pulls a list of objects (a bunch of rows; lastMonth), then the filter pulls one object (one row; individualUsage) at a time. I added Child Properties to individualUsage that exactly matched the names of the Child Properties of lastMonth. This allowed the data to properly map to individualUsage and show up in the bodies of each email.
    3. (Optional) Removed Create Index. I created a variable called Index and set the initial value to 0 so that the Create Index tile could be removed.