Custom Scripts

Custom Script Overview

If you want your survey to make decisions based on a complex logic, you can enable this by using Custom Scripts. Simply put, Custom Scripts are short transcripts of code that'll run in the backend of the survey based on the input received from the user.

You can use custom scripts for two operations:

  • Custom Script for Conditions: Can be used to configure a logic based on which an action should happen.

  • Custom Script for Piping: Can be used to pipe a response and reuse it in the survey form.

Custom Script for Conditions 

Although Zoho Survey has built-in logic for enabling conditions, in certain scenarios, using built-in conditions would be time-consuming and repetitive. Under these circumstances, a single script of code can help your survey run the desired logic than multiple repetitive conditions.

Custom Script Use Case 

Given below are the various scenarios where custom script for conditions can be implemented in Zoho Survey with their specific use cases:

  • Question Display Logic

  • Answer Display Logic

  • Page Skip Logic

  • Trigger Email

  • Survey End Page

Question Display Logic 

Let's understand how Question display logic can be easily configured using custom script.

Imagine your organization wants to rollout an Insurance scheme to your employees based on the age categories mentioned below:

Scheme I: Age 25 - 40

Scheme II: Age 41 to 55  

Scheme III: Age 56 to 70

Based on the DOB collected, the age of each individual should be calculated, and consequently, only a particular set of questions applicable to each age category should be shown to the attendee.

Since it is a complex piece of logic, a custom script should run to calculate the age of the respondent from the DOB he entered and then return a condition based on which the questionnaire suited to their age category can be shown.

 

Learn more about how to configure the steps for Question display logic using Custom Script in this page

----------------------------------------------------------------------------------------------------------------

Answer Display Logic 

Consider there's a question with multiple options that should be displayed based on a complex logic. In this case, the custom script can be used to enable the logic.

For instance, a health survey where options for a question should be shown based on the age of the responder. The only input the survey has here is the date of birth (DOB), from which the age of the responder should be calculated.

Here's how you can create a simple custom script and apply this logic:

  1. Create the question and add all the options.

  1. Click on the question and choose Answer Display Logic. Choose the condition based on which the choice should be shown or hidden, and select the applicable choices.

  2. In the condition, choose based on Custom Script and add the codes to return True.

You can refer to the screenshots of the above example below to get an understanding.

Page Skip Logic 

The Page Skip logic is useful in scenarios where the survey is extensive and attendees need to answer only certain pages.

Consider a mattress company Sleep Well is organizing a volunteer call for testing the comfort of their latest mattress Lux Layers by selecting apt product testers through a market research survey.

Now they are creating a psychometric survey with a questionnaire of 10 questions, with a score assigned to each question. The average score of the total questionnaires should be taken, and if the respondent scores above 80%, they should be taken to a new page with a second set of questions collecting their contact details. If not, the participants should be directed to the Survey End page with a thank you message.

This logic can be configured using the Page Skip logic, wherein only the qualifying participants will be redirected to the Personal details page, and the disqualified applicants will be shown the Survey End page.

Another example would be a customer feedback survey for a product wherein there are five questions, each tied to a score. In the first page, a common questionnaire will be shown to assess the satisfaction level of the respondent. If the average score comes above 60%, it means the customer is satisfied. However, if the score is below 40% and you wish to delve deeper by directing to a second page with specific questions to understand the causes of dissatisfaction, it can be done via using the Page Skip logic.

Trigger Email 

Brew Bliss Co. is providing an opportunity for product testers by crowd-sourcing taste-testing for their newest craft coffee blend, Velvet Brew. They are selecting suitable testers through a market research survey to gather feedback on flavor profiles, aroma, and overall satisfaction.

Eligible applicants should be notified by an email invitation of their selection if they score an average above 70% in knowledge of various parameters used for coffee testing. However, an email shouldn't be sent for participants who score below 70%. So, a psychometric evaluation survey with a score assigned to each question can be created and shared via social media, and all the participants who pass the required score will receive the trigger email.

Survey End Page 

Your company is organizing a recruitment drive, starting with an entirely online phase. Applicants are required to take an online aptitude test featuring 30 questions, each worth 1 point, with a passing score of 16. The results should be displayed immediately after the test to the applicants, and this kind of scenario can be easily implemented by using a custom script in the survey end page.

Custom Script for Piping 

You can enhance your survey's personalization using the piping feature. This allows you to tailor questions based on variables from earlier responses, making respondents feel more at ease when answering. For complex scenarios like piping the answer of an arithmetic operation, custom script can be used.

The custom script for piping can be used in the Survey End Page and Survey Disqualification page as follows:

Survey End Page 

  1.  Custom Message

Imagine you wish to integrate multiple conditions into a question.

For example, a survey is prepared, taking inputs like Name, Gender, and Marital status. Based on the inputs received for gender and marital status, the survey should  address each respondent as Mr/ Mrs/ Miss in the subsequent questions.

If the respondent is an unmarried woman, then she should be addressed as Miss, while a married woman should be addressed as Mrs.

This logic cannot be configured using built-in conditions, but can be piped using a custom script.

 2. Redirect to a New Page

For an online exam, the marks obtained need to be calculated and converted into grades. The grades are stored as a custom variable, then should be piped to a URL link in order to share them to another site where online certificates will be issued to the participants. This process can be implemented using a custom script that redirects users to the new page for certificate issuance.

 

Survey Disqualification page 

  1. Custom Message

 Consider a customer feedback survey, wherein there's an option for a gift-card for your service if the customer started using your product before a certain date. You have provided a question asking ”When did you start using our service?”, and there's a follow up choice question asking "Do you want the gift card?".

Now imagine for the customers who are not eligible for the gift card that you need to build logic in the survey and show them a custom message like "Since you only started using our product [X] months ago, you are not eligible for the gift card."

This scenario can be implemented using a custom script that redirects users to the new page for certificate issuance.

2. Redirect to a New Page

Now imagine for the customers who are not eligible for the gift card that you need to build logic in the survey and redirect them using the Survey Disqualification page to another webpage. This scenario can be built using the custom script.

Programming Languages for Custom Script 

 Now that we've covered the various use cases of Custom Script, let's see the programming languages you can implement to enable custom script in Zoho Survey.

 JavaScript  

JavaScript is a versatile and widely-used programming language that can be used for client-side scripting in web browsers. In Zoho Survey, you can use Java Script for conditions and piping in the following modules.

JavaScript for Conditions

These are the various features where Javascript custom script can be used:

  • Question Display Logic (link to new doc)

  • Answer display logic

  • Page Skip Logic

  • Trigger Email

  • Survey End Page

JavaScript for Piping

  • Survey End Page
  • Survey Disqualification page

 Deluge 

Deluge is a scripting language used primarily within the Zoho ecosystem. It stands for Data Enriched Language for the Universal Grid Environment and is designed to help users automate tasks and customize applications in Zoho’s suite of products. Read more about Deluge

Deluge for Conditions

These are the various features where Deluge custom script can be used for conditions:

  • Trigger Emails

  • Survey End Page

Deluge for Piping

These are the various features where Deluge custom script can be used for piping:

  • Survey End Page

  • Survey Disqualification page

   

Accessibility : 

Snippets are accessible to all Pro and Enterprise plan users.

Points To Note: 

The points given below are common for both JavaScript and Deluge:

  • If your survey is multilingual, you need to enter the specific language’s translation code to enable the condition or logic within the survey. For example, for the Tamil language, "ta" should be given.

  • If you have added conditions using the Date & Time question, then you have to use the same date format used in the previous question.

  • You can do sample tests while adding conditions to questions/pages.

    • To test, enter the code, then click Test with sample data. This will generate the sample data.

    • Click the Run button to view the sample result. You can add code and regenerate or modify the sample data as many times as you want to test.

  • To track the flow of the code, you can use the log feature provided in the insert variable box. You can view the log along with the result of the sample test.

 

 


    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION









                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                              • Related Articles

                                                                                                              • Custom Script using Deluge

                                                                                                                Deluge is a scripting language specifically designed for the Zoho ecosystem. It stands for Data Enriched Language for the Universal Grid Environment and is tailored to help users automate tasks and customize applications across Zoho's suite of ...
                                                                                                              • Custom Script using JavaScript

                                                                                                                JavaScript is a powerful and widely-adopted programming language that excels in client-side scripting within web browsers. It allows developers to create dynamic and interactive web applications. In Zoho Survey, you can leverage JavaScript for ...
                                                                                                              • Custom Report

                                                                                                                You can select questions and create customized reports. These reports can be shared or chosen by filter to show responses for specific questions. To create a custom report: Click Create in the Custom Report section. Enter a name in the Report name ...
                                                                                                              • Custom V​ariables

                                                                                                                Zoho Survey offers the following advanced features that take your surveying experience to a new level. Custom Variables Scoring Invite Reviewer Share Survey Send Copy Transfer Survey Export as PDF Print Survey Using custom variables allows you to ...
                                                                                                              • Custom Field Encryption

                                                                                                                You can now encrypt specific questions and custom variables, and the responses will be encrypted at rest (storage). For encrypted fields, only the equal to, not equal to, answered, and not answered operators will work in the reports filter. This ...
                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources