Custom Scripting

What is Custom Scripting?

The custom scripting is used to change the flow of surveys or take actions based on customized, user-defined triggers. These triggers are based on the responses to the questions.


QuestionPro offers a custom logic engine to apply code scripts in the Apache Velocity language on branching and looping. Velocity is a Java-based template engine that provides a template language to reference Java objects. You can configure this question to apply code scripts on branching and debugging with the below settings.


  • Logic includes branching : If you want to jump to a question based on specific conditions, enable this option. The survey will skip rest of the questions and jump to the destination as configured in the script code.

    Note: This option will need at least one branchTo() function to be present in the script otherwise it will redirect the user to the thank you page.

  • Logic includes looping : If you want the survey to loop through one or more questions, enable this option. It will display a set of questions repeatedly. The system saves multiple rows of data for each loop executed.
  • Debugging: This option is used for debugging the execution of the script code. You can check the output after each command is executed.
  • Auto-Submit: To auto-submit the page after script execution, enable this option. The survey will move to the next page without clicking on the 'Next' button.

What is the use of the custom logic question?

The custom logic engine question type can b used to fulfill a variety of custom requirements like

  • Course evaluation survey: The survey creator can ask the same set of questions for different courses. For each course, the survey can loop through the questionnaire.
  • Restaurant evaluation survey: Restaurant chains often conduct an online survey to collect customer feedback. If they have visited multiple food joints, the study would ask questions that compare the performance of the various outlets. You can use the custom logic question to set the custom variable with the restaurant name or location and ask questions specific to it.