Lua Scripting Resources

Important Update to Custom Scripting

SurveyGizmo's CustomScript Action now supports the LUA programming language.


Legacy Custom Scripting Language Deprecation Plans 

  1. New accounts (created after October 29, 2018) will only have the option to use Lua in scripts.
  2. As of October 29, 2018 Custom Scripting Actions will default to Lua as the scripting type in the Custom Scripting Action for accounts created before this date. You will be able to switch to the Legacy Custom Scripting; though we highly encourage using Lua.
  3. In the long term, Legacy Custom Scripting Actions will be switched to read-only. Read-only scripts will continue to function; you will just be prevented from editing. The exact date on this is to be determined; we will send notifications well ahead of time.


 Go to our Legacy Scripting Documentation.

While SurveyGizmo is one of the most flexible survey tools around, we get requests for customizations that are not available out of the box. This is where JavaScript and Custom Scripting can save the day. If you have scripting chops you can use the JavaScript action or the Custom Scripting action to achieve the survey of your dreams.


Popular Articles

  1. gettablequestionskus

    This function returns an array of SKUs (aka IDs) for the given table. This can also be used to get the SKUs for the subquestions in Custom Groups. See this function in action in an example survey . Parameters Description Required que...
  2. currentpagetitle

    This function will return the title of the current page. See this function in action in an example survey . The below example outputs the current page title to the page. print(currentpagetitle()) The output would be: Demographics See also the...
  3. addcontacttoinvite

    This function adds a contact with the specified fields to the given invite. This function allows you to collect contact information in one survey and then add those contacts to an email campaign in another survey.  Parameters Description Req...
  4. resultsquestiontotal

    This returns the cumulative sum of all the numeric values answered for the given question ID from complete responses that have been processed. If summing the values for a question with options (Radio Button, Dropdown, Checkboxes) the function req...
  5. list

    This function returns the list of responses for the given survey. This is equivalent to a get list on the SurveyResponse object via the RestAPI. To learn more visit the SurveyResponse API Object documentation. Parameters* Description Require...
  6. How to Find IDs for Custom Scripts

    Answer options, questions, pages, and surveys have unique identifiers that can be referenced in your scripts.  Survey ID To get the Survey ID, look at the URL bar while you're in the survey Build tab. The number that follows /id/ is your survey ...
  7. evaluatemergecodes

    This function returns the value for the given merge code. Merge codes need to be wrapped in single quotes ' ' so that they are represented as strings. Parameters Description Required mergecode the merge code you wish to evaluate true ...
  8. removeoption

    This function removes a multiple-choice option (by reporting value). For table questions, it hides the column associated with that reporting value for all rows. This will not reset if back button is used. If you'd like to have the option reappear us...
  9. getquestionoptions

    This function returns an array of options for the given question.  See this function in action in an example survey . Parameters* Description Possible Values Required questionID the ID of the question true type the value you w...
  10. gettablequestiontitles

    This function accepts the Question ID of a table and returns an array in the following format: [questionID] => "title"  See this function in action in an example survey . Parameters Description Required questionID the ID of the questio...