setEmbeddedData has it seems been deprecated. | XM Community
Solved

setEmbeddedData has it seems been deprecated.


Badge +4

setEmbeddedData has it seems been deprecated.

The API says use setJSEmbeddedData instead.

This setJSEmbeddedData does not update the EmbeddedData.

What am I doing wrong?

The embedded data is before the question and after each question there is a page break and a block.

Nothing updates the EmbeddedData?

icon

Best answer by Tom_1842 19 June 2023, 15:29

View original

12 replies

Userlevel 7
Badge +27

I believe this is currently only for surveys that use Simple layout. In the Survey Flow, if you have an Embedded Data field called "field", change this to be "__js_field". Then in the question's JavaScript, use 

Qualtrics.SurveyEngine.setJSEmbeddedData("field","valuetoset");

If you wanted to save this value to an Embedded Data field without the "__js_" prefix, you could create the field and set its values with piping at the end of the Survey Flow.

Badge +4

Hi Tom

Yes it is a simple Layout, so I am using setJSEmbeddedData

This is what I am doing

    Qualtrics.SurveyEngine.setJSEmbeddedData('ABC', ‘123’);    

I have a page break after the above and ABC exists in the embedded data.

But it never appears in the csv file I download, ABC is empty?

 

Badge +4

Hi Tom,

I can save the data to the embeddedData with a prefix of __js_ as you say.

But the customer does not want this prefix on the CSV download.

The customer just wants to see ABC

How as you suggest do I set the embeddedData field with piping at the end of the survey flow?

Userlevel 7
Badge +32

You should below library under look and feel header option.  Also you should add __js_ before your embedded field name. your field name looks like “__js_field”.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

 

Badge +4

Hi

I made __js_myfield to work once, now even that has stopped working?

The CSV download is now blank. 

It worked once.

Not feeling good about this software?

Userlevel 7
Badge +32

Hi

I made __js_myfield to work once, now even that has stopped working?

The CSV download is now blank. 

It worked once.

Not feeling good about this software?

Did you pass the library in survey header as mentioned in above comment.

Userlevel 7
Badge +27

On my end, jQuery does not need to be loaded into the header for Qualtrics.SurveyEngine.setJSEmbeddedData to work, but I agree it is good to include anyway for Simple layout.

I am not sure what might have changed about your setup so that the Embedded data field is not being set now, but make sure the Embedded Data field at the top of the survey flow has the prefix "__js_" and that this prefix is not included in Qualtrics.SurveyEngine.setJSEmbeddedData.

To get an Embedded Data field without the "__js_" prefix, you can create an Embedded Data field at the bottom of the Survey Flow without the prefix and then set the value with piping from "__js_" field, like in the below:

 

Badge +4

I am not allowed to add any non standard scripts to the survey.

Badge +4

Hi Tom

Been at this too long, forgot to remove the __js_ from the setJSEmbeddedData.

So in your example above I will end up with “field” in the CSV, the __js_ prefix will be lost?

 

Badge +4

Hi Tom

That worked first time, big thank you for your help!

Userlevel 7
Badge +27

You will end up with 2 columns in the CSV - “__js_field” and also “field”. They will be identical except for the column headers. I think the “__js_” prefix will have to exist in the dataset, but you can select up to 100 columns to include in data exports if you wanted to configure CSV exports that did not include it.

Badge +4

Hi Tom

I will see what the business wants, I imagine this will be OK.

 

Leave a Reply