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.


[article("bodfy")]

This question returns the specified runtime property for the given question ID.

See this function in action in an example survey.
Parameters*
Description
Required
questionID
the ID of the question
true
propertythe property you wish to lookup
true

*Provide parameters in the above order.

Available PropertiesDescriptionReturned Value
"Hidden"Hidden settingboolean
"Required"Required settingboolean
"Soft-Required"Soft-Required settingboolean
"Disabled"Disabled settingboolean
"Rendered"Indicator for whether the question was renderedboolean
"Answered"Indicator for whether the question was answeredboolean
"Number"Question number assigned to question at runtimeinteger
"Comment"Get raw data from Comment FieldsArray
"Data"Get raw data from Signature QuestionsArray

Examples

In this example, we use the runtime property "Number," which returns the question number assigned to the question by ID at runtime. Then we concatenate these values to store the unique random order of the questions for this response. Finally, we set the value of a textbox equal to this random order to store for later reporting.

property = "Number"

q1 = getquestionruntimeproperty(2,property)
q2 = getquestionruntimeproperty(3,property)
q3 = getquestionruntimeproperty(4,property)

randomorder = q1 .. q2 .. q3

setvalue(8,randomorder)

See also the following working examples for use of this function: