Linking embedded javascript data from a multiple choice question answer to an email address/action | XM Community
Skip to main content
Hello Everyone!

We have been really struggling with this one, and I would appreciate any assistance anyone can offer. We have a list of about 30 departments, and we need an approval email to go out to an individual email based on the choice selected. We have been creating actions for this, but that has become extremely cumbersome.

We are trying to set embedded data based on a response selected. Then we could just have one email template, and pipe the embedded data email address into the to field. The question has 30 possible answers and each will create a unique value in one field.



Here is the code we are using. This code activates a trigger for the first email entered "Email@XXX.edu, every time, no matter which of the 30 options we select.



Qualtrics.SurveyEngine.addOnload(function()

{

document.getElementbyID("QID5").style.display="none";



this.questionclick = function(event,element)

{

console.log(event, element);

if (element.tagName == 'SELECT')

{

var choiceNum = element.value



if (choiceNum == 1) {



Qualtrics.SurveyEngine.setEmbeddedData("SBAEmail","Email@XXX.edu");



} else if (choiceNum == 2) {



Qualtrics.SurveyEngine.setEmbeddedData("SBAEmail","Email2@yahoo.com");



} else if (choiceNum == 3) {



Qualtrics.SurveyEngine.setEmbeddedData("SBAEmail","Email3@gmail.com");

}

}

}

});



Is element.value the correct way to call up the response number value?

I am teaching myself how to code, so dumbed-down answers are appreciated 🙂
See: https://www.qualtrics.com/community/discussion/7700/trying-to-set-embedded-data-from-radio-or-dropdown-response

Leave a Reply