Getting ResponseID using JavaScript with getEmbeddedData? | Experience Community
Skip to main content
Solved

Getting ResponseID using JavaScript with getEmbeddedData?

  • February 19, 2019
  • 2 replies
  • 359 views

I've used Survey Flow to Set Embedded Data, adding ResponseID at the beginning of the survey. I'd like to get the ResponseID using JavaScript. Although I can pipe the ResponseID as text into the question text, the following JavaScript does not work: Qualtrics.SurveyEngine.addOnload(function() { console.log("In function added via addOnload"); console.log(Qualtrics.SurveyEngine.getEmbeddedData('ResponseID')); // prints `null` }); Thanks!

Best answer by ar0

Here's the solution: ``` console.log("${e://Field/ResponseID}"); ``` Works as expected. There is no mention of this "$" syntax on the JavaScript API page.

2 replies

  • February 19, 2019
Hello @ar0 , To read embedded data in the JS we use piped text of embedded data wrapped with the double quotes. For eg: `console.log("${e://Field/ResponseID}");` OR var s = "${e://Field/ResponseID}"; console.log(s);

  • Author
  • Answer
  • February 19, 2019
Here's the solution: ``` console.log("${e://Field/ResponseID}"); ``` Works as expected. There is no mention of this "$" syntax on the JavaScript API page.