Question
Personalised feedback email
We have a survey which should provide personalised feedback in an email, but each question/answer has its own feedback. E.g. question 1 has answer options 1A, 1B, 1C and each of these answers have their own feedback. Question 2 has answer options 2A, 2B, 2C again with their own feedback. There are too many combinations to prepare an email for each scenario. At the same time it is not possible to use if-then-else in an email (as far as I know) so the conditional logic has to happen somewhere else.
Note that "In Page Display Logic" can be used to give direct feedback, but it's the email part that I am having trouble with.
My solutions so far are to use Javascript and a Descriptive Text element, or to use Javascript with a Text Entry element.
`$answer1 = "${q://QID1/ChoiceGroup/SelectedChoices}";`
`$answer1 = "${q://QID5/ChoiceGroup/SelectedChoices}";`
`$advice = "<div class=\\"QuestionText BorderColor\\"><strong>Your feedback:<\\/strong>";`
`switch ( $answer1 ) {`
` case "lorem ipsum": $advice = $advice + "<br \\/>Feedback 1a"; break;`
` case "dolor sit amet": $advice = $advice + "<br \\/>Feedback 1b"; break;`
` case "consectetur adipiscing elit": $advice = $advice + "<br \\/>Feedback 1c"; break;`
`}`
`switch ( $answer2 ) {`
` case "sed do eiusmod": $advice = $advice + "<br \\/>Feedback 2a"; break;`
` case "tempor incididunt": $advice = $advice + "<br \\/>Feedback 2b"; break;`
` case "ut labore et dolore": $advice = $advice + "<br \\/>Feedback 2c"; break;`
`}`
`$advice = $advice +"<\\/div>";`
`jQuery("#"+this.questionId).html($advice);`
This generates a custom text with a proper layout. I can reference the Descriptive Text element through Piped Text. It does not show up in the Piped Text menu (it apparently does not show static content), but you can create it yourself. It's ${q://QIDn/QuestionText} where n is the number of the element.
However, the email shows the original text instead of the updated text. Probably because it's static content and there's no permanent document.write taking place. So this solution does not work unless Qualtrics can remember my changes.
The second solution tries to fix this by using a Text Entry element. Main differences are that I have to use \\n instead of br and the command to write the feedback text to the element uses val instead of html:
`jQuery("#"+this.questionId+" .InputText").val($advice)`
The email shows the custom text, but the layout is terrible. Even the linebreaks are gone, so it becomes one long sentence.
A textbox will not allow any HTML codes inside it so if I use HTML codes those will be shown literally in my email.
I am now experimenting with a Descriptive Text element to show feedback to the user, and multiple Text Entry elements for each line of advice. But that only works if every answer provides feedback and that's not really the case. We are only supposed to provide feedback on certain answers.
If I can't get it to work in Qualtrics we will just export the answers and solve the problem (easily) in Excel with a mail merge, but it seems a bit silly that Qualtrics can not do something as basic as this. I am probably overlooking something. Any help would be much appreciated.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
