1

Questionnaire Designer examples

From Resco's Wiki
Jump to navigation Jump to search
Resco Inspections
Backend-specific
Innovations
Miscellaneous

This article describes several useful examples of using the Questionnaire Designer.

Fields are automatically filed using On Load rule

You might want some fields to be automatically filled in when a user starts the questionnaire.

  1. Open On Load rule editor on a questionnaire.
  2. Set up a rule with the following logic:
    1. Add the condition If the questionnaire is new.
    2. Add Step: For the question Date and Time set the value to now.
    3. Add Step: For the question Filled by set the value to the current user.
  3. Save the rule, questionnaire, and test it in the application.

QD examples: Fields are automatically filed using On Load rule

Access parent entity from On Load rule

The following example is similar to the example above, however, we want to fill in fields from the parent record of the questionnaire. In this case, it's actually a grandparent: The questionnaire's parent is the appointment from which it was initiated, and we want to add fields from the appointment's account to the questionnaire.

  1. Add the regarding lookup component to your questionnaire. You can make it invisible in the app if you want. The component behaves just like a simple question, however, it is filled in automatically by the appointment reference from which the questionnaire is opened.
    QD examples: Access parent entity from On Load rule (regarding lookup question)
  2. Click On Load to open the rule editor.
  3. Create a local variable (lookup type) and load the regarding lookup into it.
  4. Create a local variable (entity type) and load the parent appointment based on the reference.
    QD examples: Access parent entity from On Load rule (create variables in On Load rule)
  5. Check if the appointment was loaded successfully, then save the appointment ID to a string variable and use the ID to find the account.
    QD examples: Access parent entity from On Load rule (loading data to the first variable)
  6. Check if the account was loaded successfully, then you can start adding steps that fill in questionnaire fields from the related account entity.
    QD examples: Access parent entity from On Load rule (loading data to the second variable

Automatically copy answer to a custom field

Resco Inspections has a nice hidden feature: if the question’s technical name matches the schema name of the custom field on the Questionnaire entity, and both are of the same data type, the answer’s value will be automatically stored in the custom field. This might be useful in many situations, such as if you want to associate the answered questionnaire with a specific entity record via the lookup field, or if you have JSON-enabled questionnaire and want to store the specific answers’ values directly in the custom fields on the Questionnaire entity for the analytical purposes.

Example: The business requirement is to automatically associate the answered questionnaire with the selected Account record, so in Dynamics, it’s possible to see all the related answered questionnaires directly on the Account entity form.

Detailed steps

  1. In Dynamics, create a new custom lookup field in the Questionnaire entity called Account (schema name: new_accountid) targeting the Account entity. Save and publish the changes.
  2. (Optional) In Dynamics, place the new lookup field on the Questionnaire entity form. Save and publish.
  3. In Woodford, enable the new lookup field on the Questionnaire entity. Save and publish the app project.
  4. In the Questionnaire Designer, open the questionnaire template and add a lookup question called "Account" targeting the Account entity. The internal name of the question must match the schema name of the lookup field created in step 1 ("new_accountid"). Save changes.
    QD examples: Automatically copy answer to a custom field (New lookup question with matching internal name)
  5. (Optional) By default, the answer is only copied when completing the questionnaire. If you want the value updated whenever you save an in-progress questionnaire, click Options and on the Rules tab, set Validate On from "Complete" to "Save & Complete". Save all changes.
  6. Sync the mobile app, fill in the questionnaire (especially the Account lookup question), save/complete the questionnaire and sync the app again.
  7. In Dynamics, open the answered questionnaire record. Note that the Account lookup field is filled in with the corresponding Account record.
    QD examples: Automatically copy answer to a custom field (questionnaire form)
  8. In Dynamics, open the corresponding Account record and switch to related Questionnaires to see the answered questionnaire(s) associated with the selected account.
    QD examples: Automatically copy answer to a custom field (Account form in dynamics)

Show additional question depending on previous answer using On Change rule

When a user answers a question in a certain way, you might want to display additional questions. For example, married users need to provide the name of their partner.

  1. Create a group with two questions:
    • A single choice question: Are you married? (Answers: Yes, No.)
    • A text question: Partner name. Invisible by default
  2. Select the first question and click On Change.
  3. Set up a rule with the following logic:
    1. Add the condition If: If the answer to the are-you-married question is Yes.
    2. Add Step: Then set visibility for the question partner-name to True.
    3. Add Else.
    4. Add Step: Else set visibility for the question partner-name to False.
  4. Save the rule, questionnaire, and test it in the application.

QD example: Show additional question depending on previous answer using On Change rule example

Reuse questionnaire answers from related records

You can now use fetch variable {{Regarding}} to access (related) entity of activity, if the activity is regarding the record of the questionnaire. This means that you can reuse previous answers from a specific appointment, or a specific asset if opened through an appointment.

  1. Edit a questionnaire template in Questionnaire Designer.
  2. Click Options and go to the Features tab.
  3. Set Reuse Answers to your preferred option other than Never.
  4. In the Reuse Fetch, click Edit.
  5. The default filter has four conditions.
    • Click Add Condition and add the following condition:
      QD example: Reuse questionnaire answers from related records (reuse fetch)
    • Click Variable and select Regarding, then click OK.
      QD example: Reuse questionnaire answers from related records (select variable in the fetch)
  6. Click Save & Close to close the filter editor; then Save to close the Options window.
  7. For each question that should reuse previous answer, select it and check Reuse on the Properties pane.
  8. Finally, save the questionnaire template.

Add custom icon for questionnaire group

It is possible to add a custom icon for a question group in questionnaires.

  1. Edit an app project in Woodford.
  2. Select Design > Images from the Project menu.
  3. Create a folder called "Questionnaire".
  4. Add an icon with a name that matches the question group name.
  5. Save everything and publish the app project.

QD examples: Adding custom image for question group

Group icons deep dive

If your questionnaire includes multiple groups, you can switch between groups in the app. On Android and iOS, you can swipe down to display the list of questionnaire groups. On Windows, you can click the questionnaire caption to display this list.

Group icons android.png Group icons windows.png

Default group icons

There are actually 3 default icons:

  • Standard
  • Selected
  • Complete

As you can see in the app on the screenshots above, the standard icon is not used in the questionnaire body. It is used when switching groups using the group list. The same applies to the "selected" icon. It is only visible on Android/iOS; on Windows devices, the behavior is slightly different and the icon is not used.

The "complete" icon is used for groups that you mark as complete using rules. See Track group completion below.

The default "standard" and "selected" icon reuse the assets from the general form tab. You can change the default icon, but it will also affect your forms. The dash at the end of "General-" indicates that it's the "selected" icon.

QD examples: Default group icons: tab image folder

The default "complete" icon is hardcoded in the app. You can upload your own default icon for completed groups: it belongs to the "Questionnaire" folder with the name "-complete".

Custom group icons

As described above, you can add custom icons. The standard file name must match the name of the questionnaire group. Add the "-" suffix for selected icons and "-complete" suffix for complete icons.

QD examples: Custom group icons: Questionnaire image folder

Track group completion

For each question group, you can track the completion percentage using rules. For example, you can make a group complete when all questions in the group are answered. Select the question group in the designer and add a suitable On Change rule.

QD designer: Track group completion(Complete address group when all questions are answered)

A direct implication visible in the app is that the icon of the question group changes to "complete" (either default or custom). This allows the inspector to quickly see which question groups are done and which need answering. You can also tie further business logic to the completion. The following example of an On Can Execute rule enables a command when 3 groups are complete.

QD designer: Track group completion(Enable command when groups are complete)

Risk matrix

The risk matrix does not exist as a question type in the Questionnaire Designer. However, a clever combination of multiple option set questions with custom styles offers a very similar user experience.

QD examples: Risk matrix in questionnaires

Check out our blog for more information Blog




Was this information helpful? How can we improve?