Using addEmbeddedData to create embedded data on the fly | XM Community
Skip to main content
Solved

Using addEmbeddedData to create embedded data on the fly

  • May 6, 2020
  • 2 replies
  • 106 views

Hi there,
I am using javascript in my survey to set many embedded fields. Here is the code:

//get question id
var qid = this.questionId;
//store the value in an embedded field
Qualtrics.SurveyEngine.addEmbeddedData( qid + "VideoName", currentVideo );
Qualtrics.SurveyEngine.setEmbeddedData( qid + "VideoName", currentVideo );

Where currentVideo is a string.

Unfortunately the embedded fields are not being created. I have so many it would be annoying to manually create an embedded field for every question. Is there a way to create an embedded field using only javascript?

TIA

Best answer by rondev

addEmbeddedData works only on a page. Hence we cannot create embedded data using JS. We have to declare all the ED in the survey flow at the beginning and then only we can use setEmbeddedData function.
If you want to create many ED then upload a CSV file to a contact list, with all ED present in it. Then in the survey flow add ED element and click "add from contact" option.

2 replies

rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • Answer
  • May 6, 2020

addEmbeddedData works only on a page. Hence we cannot create embedded data using JS. We have to declare all the ED in the survey flow at the beginning and then only we can use setEmbeddedData function.
If you want to create many ED then upload a CSV file to a contact list, with all ED present in it. Then in the survey flow add ED element and click "add from contact" option.


  • Author
  • May 6, 2020

Thank you rondev - great idea!