If you are using merge codes to reference information collected in your survey, from time to time you may see the following error:
[Invalid question ID: "X". Check your merge code.]
This error could pop up in the following places:
- Question Text
- Text Elements
- Actions - Most commonly, these errors are found in the message content of a Send Email Action or the Slack Action.
Have you come across this error? Not sure why? This happens from time to time, typically in copied surveys or long-running surveys. There are a number of places where this can happen; basically wherever merge codes can be used, which is just about everywhere!
To brush up on merge codes check out our Merge Code Tutorial for more info.
What Causes the Error?
The error happens when a merge code references a Question ID that no longer exists. In our above example, our survey is referencing question ID 2 via a merge code that was added to a Text Instructions Element. However, we deleted question ID 2 from our survey and now the merge code can't reference that question anymore.
You can see how this might happen more often in copied surveys. Say you copy a survey that a colleague built. You add a few questions, delete a few questions, and send out the share link forgetting there are merge codes being used throughout the survey or within a send email action. Boom! Error messages all over the place!
How Do I Fix It?
Alchemer will not automatically update or fix invalid merge codes. They are invalid because the questions that they are referencing are no longer in your survey. As such, you will need to locate these invalid merge codes and either remove or update them.
Using our above example (where we see the invalid merge code in a Text Element), let's see how we can fix this issue:
- Assuming you received the invalid merge code error, head to the survey's Build tab and edit the question, element, or action that contains the error. In our example, we will edit the Text Element that generated the error.
- In our example, the error was generated by Question ID 2 (since that question was deleted from our survey). As such, we will delete this merge code from our text element.
In some cases, this is all you need to do. Perhaps in your case the question was deleted because it was no longer needed. If this is the case, you can delete the merge code, save the element, and be finished. - In our example, Question ID 2 was deleted, but it was replaced with a new version of the question. As a result we will need to add a merge code for the new question. To do so, we will use the Merge Code helper tool to add the merge code for the new question.
- We now have the correct merge code inserted into our Text Element and will no longer see the invalid merge code error.
Check out our Merge Code Tutorial to learn how to use the Merge Code Helper to insert the proper merge codes. You can even take advantage of our Find & Replace tool to search for merge codes in larger surveys.
Identify Additional Invalid Merge Codes
If you are concerned that you have additional invalid merge codes, the best way to identify these is to manually test your survey. This process should help you see any invalid merge codes in questions and text elements. Make sure to toggle the setting to Fire Actions to make sure that any actions that might be using merge codes don't get missed.
Free Individual SurveyGizmo Enterprise*
*Excludes Stakeholder
Feature | Included In |
---|