Conditional formatting within an email trigger based on a score | XM Community
Skip to main content

I have an email trigger set up to report a variety of subscores from a survey. This email gets sent to the same person every time a survey is completed. Here is what the summary email looks like:

Score A = 10

Score B = 15

Score C = 11

 

Each score has a different cut-off number (anything above that number is relevant). I want the score (which is being displayed in the email trigger using piped text) to either be highlighted red or the text color to be red if that number meets the cut-off. So, for example, if the cut-off score is equal to or greater than 11, the email summary above would instead look like this:

Score A = 10

Score B = 15

Score C = 11

 

I am assuming custom code is needed to achieve this, and that I would need conditional formatting for each set of piped text (since each score has a different cut-off number). Please note that I am a total novice when it comes to html code, so please be basic in your instructions. Thank you!

@Mattea123 

You can do this within survey flow and directly pipe the text in email.

Just include two embedded data one which would have the actual score which was obtained and other would be it’s cutoff. Post which you can have branch logic included as below. Below example is where cutoff is 11 and relevant score value would be in ScoreA and then you can change the color via HTML and CSS. Then include this embedded data in the Email Task.

<p style="color: red;">${e://Field/ScoreA}</p>

 

Hope it helps!


@Deepak  I was wondering if embedded data was the answer! This is helpful, thank you. I do have a couple follow-up questions:

  1. Which embedded data field would I then pipe into the email?
  2. If I pipe the branched embedded data field and the score does not meet the cutoff, will there be an error message?

Thank you!


@Mattea123 So, your ScoreA, ScoreB, ScoreC… would be the embedded data to pipe on you will just update that values color and nothing else with that branch logic, as they contain the actual value of the score. 

In the image I have kept ScoreA value empty you have to fill it with actual score value. 

If it doesn't meet the cutoff it will not be in red color, there will be no error message.

Hope it helps!


Leave a Reply