If you are utilizing Custom Scripts in your surveys, you will likely have a need for referencing answer options, questions, or survey pages. Each of these items have their own unique identifiers that can be referenced in your scripts. Read on to learn how to access these IDs.
Your Survey ID
To get the Survey ID take a look at the URL bar while you're in the survey Build tab. The number that follows /id/ is your survey ID.
Customizing Your Build Tab to Display IDs
Question and Page IDs are available on the Build tab. Click the link to View Settings link found above Page One of your survey. Select Page IDs and Question IDs, then click Apply.
Throughout the survey, you will have your Question IDs and Page IDs available to you. Page IDs will be visible directly to the right of your page title. Question IDs will be visible under every survey question.
Using the Survey Legend to Obtain IDs
If you are looking to access all IDs at once, you might try the Survey Legend available under the Tools Menu. This will display Question IDs and Option IDs (sometimes referred to as SKUs) as well as other metadata about your survey elements. You can download the Survey Legend to Word in the top right-hand corner of the page if you wish!
Using the ID Lookup Tool to get IDs within Your Custom Scripting Action.
While there is an option to eliminate the use of IDs that change across surveys (see our tutorial on Custom Scripting with Question Aliases), you'll likely still need to access page, question and option IDs when writing scripts.
Within your custom script action, you can use the Question & Page ID Lookup tool to get all of the IDs for your scripts.
Simply click the dropdown and scroll to the question, page, or option you wish to use in your script.
When you select it, that page, question or option ID will display just above your script, for reference.
Alright, so how do I use this in a script?
If you're familiar with our merge code helper that is available throughout elsewhere throughout the Build tab for dynamically merging in the proper merge code with the appropriate ID based on the question, you select you might be expect this dropdown to work similarly. Unfortunately this will not insert the ID at your cursor (though it would be great if it did!) This is basically just a display tool to give you quick access to the IDs you need in your scripts. You'll still need to key the ID value within your scripting function as necessary.
Our scripting documentation covers all the functions available in Custom Script including those that require IDs.