Is there a way to auto-code an option in a single choice question using an embedded data field? | XM Community
Skip to main content

For one of my online campaigns, I am capturing the program name from a parameter in a URL and storing it in an embedded data field. Based on the data that is captured a single choice question in the survey has to be coded automatically.
E.g. The embedded data field 'ProgramName' has the data 'Program1'. Based on this the option Program1 in a single-choice question (as shown below) should be auto-coded.
What is the name of your program?

  1. Program1

  2. Program2

  3. Program3

I assume JavaScript code would be required. Any suggestions or ideas to achieve this will be really helpful.

If it's just three choices, you can use combine default choices with display logic.


This is just an example and there will be more choices in this question. I will be running many programs in the next few months, some of them simultaneously, and the same survey link will be used for all these programs. I understand what you are suggesting. But doing it this way will require the display logic to be updated for each program.
I want to set it up such that based on the program name captured in the embedded data field the corresponding option in the question gets coded automatically.


Leave a Reply