Store last answered questionnumber into an embedded data field of an unfinished response | XM Community
Skip to main content
In a survey I have set the option of partial completed responses set to recorded responses after 4 hours after the respondents start of survey. What I like to have is an embedded data field called 'LastQuestion' containing the last used question number. Like the column in the Data & Analysis tab under Responses in Progress where a column Last Question exists. Is such an option possible?
Add "LastQuestion" as an embedded data field in the survey flow and this JS to the header inside a `<script>` tag:

```

Qualtrics.SurveyEngine.addOnload(function() {

Qualtrics.SurveyEngine.setEmbeddedData("LastQuestion", jQuery(".QuestionOuter:last").attr("id"));

});

```

It will save the QID of the last question on the last page where they clicked Next.
Thanks! This works!

Hi guys,

I have the same problem as Nico_Leussink . Where is it possible to add JS to the survey flow? And can you detail what the "header" is please?
There is no solution to add the "Last Answer" as embedded data in the survey flow without JS?

Thanks by advance,
Victor


https://community.qualtrics.com/XMcommunity/discussion/comment/43555#Comment_43555You can't add JS to the survey flow. Add the JS to the header (Look & Feel - General - Header (edit) - <> (source mode)).


Thanks a lot for your help TomG 🙂
Do you also have the JS code regarding the progress? (By progress I mean the time someone spend on the survey).

Thanks by advance,
Victor


https://community.qualtrics.com/XMcommunity/discussion/comment/43563#Comment_43563The number of seconds someone has spent taking the survey is always stored in the embedded data field Q_TotalDuration.


Thanks for your help and reactivity.

I added the LastQuestion and Progress embedded data in the workflow of my surveys.
I know want to add it in the "respondent journey" in the repertory settings (see picture), but the data do not appear... Do you know why?
image.pngThanks again by advance,
Victor


https://community.qualtrics.com/XMcommunity/discussion/comment/43569#Comment_43569No, sorry.


Thank you! This is great!
Can it be done to give the user friendly question name instead of the QID?


https://community.qualtrics.com/XMcommunity/discussion/comment/53264#Comment_53264Not easily. The only way to get the question label to to turn on question numbers. Then you have to hide the question numbers and extract the last question number from the question html.
You should vote for this product idea.


Leave a Reply