create_question
Create a survey question in a Qualtrics block with full control over payload, supporting all question types and advanced fields like validation, JavaScript, and custom configurations.
Instructions
Create a question in a survey block with full payload control. For Matrix questions: Choices = rows/statements, Answers = columns/scale points (both required). Use additionalFields to pass any other Qualtrics question-definition fields (e.g., a template from get_question_template). For common types, prefer the add_*_question helpers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| answers | No | Answer definitions keyed by answer number (columns/scale points — required for Matrix) | |
| blockId | Yes | The block ID to add the question to | |
| choices | No | Choice definitions keyed by choice number (rows/statements for Matrix) | |
| selector | Yes | Question selector (e.g., SAVR, MAVR, SL, ML, Likert, TB) | |
| surveyId | Yes | The Qualtrics survey ID | |
| questionJS | No | JavaScript to attach to this question (QuestionJS). IMPORTANT: Avoid literal `${` in JS strings — Qualtrics interprets it as piped text and corrupts the code. Use `\x24{` or `String.fromCharCode(36)+'{'` instead. | |
| validation | No | Validation settings | |
| answerOrder | No | Display order of answer keys (derived from answers if omitted) | |
| choiceOrder | No | Display order of choice keys (derived from choices if omitted) | |
| subSelector | No | Sub-selector if applicable (e.g., TX, SingleAnswer) | |
| questionText | Yes | The question text (HTML supported) | |
| questionType | Yes | Qualtrics question type (e.g., MC, TE, Matrix, Slider, RO, CS, DB) | |
| recodeValues | No | Numeric recode mapping keyed by choice/answer id | |
| configuration | No | Configuration object (e.g., {QuestionDescriptionOption: 'UseText', TextPosition: 'inline'}) | |
| dataExportTag | No | Custom export tag (recommended; a readable unique tag derived from questionText is generated if omitted) | |
| additionalFields | No | Any other question-definition fields, applied before the explicit fields above (e.g., SBS AdditionalQuestions, slider configs, a get_question_template result) | |
| questionDescription | No | Internal label shown in the editor (derived from questionText if omitted) |