How do you get the Embedded Data from a previous survey to populate a follow-up survey using variable names in multiple choice questions? | XM Community
Skip to main content

Hi,

I am relatively new to Qualtrics and have been trying desperately to figure out how to populate a follow-up survey using embedded data for multiple choice and multi-select (e.g. select all that apply) questions. I believe my question is similar to one posted previously and answered by @TomG (link and code below) - however, I have variable name data in my contact list (embedded data) rather than a recode value. Would you be able to help me edit this JS code to use with variable names (in the example in the link below, it would be the organization type (name))? Is this even possible?

Link to discussion: https://community.qualtrics.com/custom-code-12/how-do-you-get-the-embedded-data-from-coded-questions-to-populate-a-follow-up-survey-20946

 

Solution provided by @TomG:

You can use JS to prepopulate the org type question like this:
Qualtrics.SurveyEngine.addOnload(function() {
var qobj = this;
var recodes = "${e://Field/OrgTypeRecode}".split("%2C");
jQuery.each(recodes, function(i, val) { qobj.setChoiceValueByRecodeValue(val, true); });
});
The same basic code should work for any MC question as long as the recodes are consistent across surveys. If you don't url encode the recodes the split string would be ", ".

 

Thank you so much for your help!

Be the first to reply!

Leave a Reply