(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.data-privacy-src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-PF5R8F7');

Knowledge Base

Custom Questions and On-the-Fly Questions

Custom Questions

Custom Questions is a powerful feature that allows developers to code their own questions tailored to collect and validate answer data using HTML and JavaScript.

With this feature, you have the flexibility to collect as much data as you want with a workflow that best suits your needs. For example, you could specify the flow of custom questions based on context or answer trees within your script.

Context variables include:

__SCAN_VALUE__

__SCAN_RESPONSE__

__SCAN_STATUS__

__USERNAME__

You can format questions in specific ways (date, zip code, phone number, etc.). Also, you can check if an answer fits an expected profile. You can ask one question or many questions with each Custom Question. The core value is that the app user’s answer (or answers) for each Custom Question is saved as part of the official scan record.

To add custom questions, you can use the API or the web UI located on the Questions page and Questions tab when creating a Service. There are two options: URL and HTML. Clearly, the most flexible is the URL option. However, the HTML option is valuable if collecting data offline or if you don’t want to use your own servers.

Here are a few Custom Question (CQ) example scripts:

Here is an API doc that shows basic instructions for setting up custom questions for barcode scanning. Also, here is a PDF file that has code examples for the __SCAN_VALUE__ and __SCAN_RESPONSE__ variables.

Notes:

  1. Photo Collect and Signature Capture are not supported within a Custom Question. Instead, you will need to use Custom On-the-Fly Questions.
  2. You can now create a custom question for scanning. Please look here for an example script.
  3. For both Custom Questions and On-the-Fly Questions, if the scan response status or response text on a secondary submit is different than it was on the initial submit, we can show the response instead of automatically moving to the next scan like it does by default. Until it becomes public, ask the support team to add the property showScanResponseChanges=true to your service. You can also add this service property with the API.

Custom ‘On-the-Fly’ Questions

In addition to the standard no-coding options for collecting data with questions through barcode scanning, we offer programmers the option to create ‘On-the-Fly’ questions when using our Postback URL feature. You only need to show the app-user these questions when you choose to based on the context. Whereas, with a Custom Question the app user always sees the option to answer a question after a scan.

An On-the-Fly question works like this:

  1. The scan record is posted in real-time to your server
  2. Your server will see the barcode value scanned and any answers to questions made by the app-user before submitting the scan.
  3. Your script can process that information and present the app-user with more questions to answer. Also, you can choose to not present any questions.
  4. When the app-user answers those questions, they submit it. Then, you can ask more questions. If satisfied, allow the app-user to move on to the next scan.

For instructions, please see our documentation to use Postback URL.