Embedded Field not populating in Data & Analysis tab before page submits? | XM Community
Question

Embedded Field not populating in Data & Analysis tab before page submits?

  • 29 July 2020
  • 1 reply
  • 5 views

Hi Team,
Embedded Field not filled before page submits as I guess..

Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
var apiResponse = JSON.parse(this.responseText);
var contactInfo = apiResponse.result.elements[0];
firstName = contactInfo.firstName;
lastName = contactInfo.lastName;
Qualtrics.SurveyEngine.setEmbeddedData("ContactFirstName", firstName);
Qualtrics.SurveyEngine.setEmbeddedData("ContactLastName", lastName);
alert(Qualtrics.SurveyEngine.getEmbeddedData("ContactFirstName"));
// Here I am able to get the first name in alert But this field not updating first name in Data & Analysis tab of Survey
}
Api is returning correct response in var apiResponse


1 reply

Badge +2

How about trying setting the embedded data on a click versus page submit. see code below. Also, make sure your set embedded data block is before the survey question block in survey flow.

jQuery("#NextButton").on('click',function(){

Leave a Reply