I have an Embedded Data variable ${e://Field/ My_multiline_text }, which will store a mutiline text
I need a JS code which appends a string and put it on the new line, depending on survey answers. Something like the following:
var p2Text = "${q://QID1/ChoiceGroup/SelectedChoices}";
if (p2Text =="Yes") {
Qualtrics.SurveyEngine.Append_EmbeddedData("My_multiline_text", "Hello baby" );
}
p2Text = "${q://QID2/ChoiceGroup/SelectedChoices}";
if (p2Text =="Yes") {
Qualtrics.SurveyEngine.Append_EmbeddedData("My_multiline_text", "I love you baby" );
}
p2Text = "${q://QID3/ChoiceGroup/SelectedChoices}";
if (p2Text =="Yes") {
Qualtrics.SurveyEngine.Append_EmbeddedData("My_multiline_text", "I miss you baby" );
}
So at the end of the survey, ${e://Field/ My_multiline_text } would contain a multiline text:
Hello baby
I love you baby
I miss you baby
I am going to pipe in ${e://Field/ My_multiline_text } into my email trigger message body.
Thanks!
Looking for JS to append a string to an Embedded Data variable
Best answer by pogi
You can concatenate Embedded Data simply by adding
new_text = ${e://Filed/My_multiline_text} + "\\n" + "Hello baby";
Qualtrics.SurveyEngine.setEmbeddedData( 'My_multiline_text', new_text);
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

If the respondent selects "I am a Physics major", then ${q://QID1/ChoiceGroup/SelectedChoices}" should return "I am a Physics major".