Adding questionnaires to app projects

From Resco's Wiki
Revision as of 09:38, 16 July 2021 by Jzambor (talk | contribs)
Jump to navigation Jump to search
Resco Inspections

If you are using Resco Mobile CRM as your app with Resco Inspections, you need to add questionnaires to your app projects.

The easiest way is to use out-of-the-box integration: add inspections in a few clicks to the home screen or to an entity form. Resco platform offers many other ways how to access inspections from the app, and some are described in this article.

Add to home

  1. Edit an app project.
  2. Select Inspections in the Project menu.
  3. Click Add to Home.
    25 Add to Home.png
  4. Save everything and publish the app project.
  5. The home screen menu in the app now includes inspections.
    24 Home form templates.png

Add to form

  1. Edit an app project.
  2. Select Inspections in the Project menu.
  3. Click Add to Form, then select an entity and click OK.
    28 Add to Form.png
  4. Save everything and publish the app project.
  5. The form of the entity in the app now includes an inspections tab.
    26 Entity form Inspections 1.png
    27 Entity form Inspections 2.png

Create separate views for questionnaire templates and answered questionnaires

Administrators can create custom views via Woodford:

  1. Choose the Questionnaire entity from the Project menu in Woodford.
  2. Click Show UI, then click New View.
  3. Rename the view so it is clear whether it is for templates or answered questionnaires.
  4. Open the view and edit its filter:
    • For templates, add condition "Is Template Equals Yes".
    • For answered questionnaires, add condition "Is Template equals No".
  5. Once the view is created, save the changes, publish and sync the application.
  6. Open Questionnaires in the application. You can now switch to your custom view.

Additionally, you might want to ensure that only published questionnaire templates are displayed in the Questionnaire Templates view. The information whether a template is published or not (and in general what is the state of the template) is stored in the Status Reason field on the Questionnaire entity.

Therefore, you can add one more condition into your Questionnaire Templates view - the Status Reason should equal Active;Published. If you prefer to have also other Templates (drafts or deactivated) displayed, you can omit this step or include other values as well.

Distinguish partially answered (saved) questionnaires and completed questionnaires

In the mobile app, it is possible to save the questionnaire with information only partially filled in – which is particularly useful for large questionnaires. Once all the data has been filled in, the questionnaire can be validated and completed.

Based on your use case, you might want to use this information and create views for answered questionnaires which are completed or the ones which are answered only partially.

Again, there is a handy field on the questionnaire entity called resco_completionstatus. This field is empty for all the questionnaires that have been filled in (partially, not at all, or even fully), saved, but not completed. Once the questionnaire has been successfully completed, this field will hold the value 1.

To create a view that shows only completed questionnaires start as in the previous chapter (create a view where Is Template equals No) but add one more condition with resco_completionstatus equals 1.

Note Questionnaire which is not saved as Completed, is saved as a Draft. When saving a Questionnaire as a Draft, its required fields are not validated and it is possible to save the Questionnaire without filling them. These fields are validated upon the Questionnaire completion.

Use questionnaires on a specific entity

To be able to show questionnaires for a certain entity, you must place the questionnaire list on the entity view.

  1. Choose an entity in the Woodford entity menu.
  2. Open its edit form.
  3. Click on Add List.
  4. Choose Unrelated Entity list - Questionnaire > Questionnaires List.

Once Questionnaire List is set on edit form, after opening the form in the application, Questionnaires are available as one of the tabs. If you click on the Questionnaire tab on the form, you will see all the Questionnaires available to the user – both templates and filled questionnaires (with answers).

It is possible to rename the tab using the Rename button.

Show only questionnaire templates on certain entity

To show only questionnaire templates in the Questionnaire tab on entity, double-tap on the Questionnaires List to open its properties and select only Questionnaires – Templates view.

Note It is not recommended to create an edit form for Questionnaire entity. If you do so, the questionnaire mechanism won't display questionnaire templates correctly once they are used as tabs (unrelated lists) on other entities.

Automatically relate questionnaire with entity records

To set up a relationship between the entity record and the questionnaire, we need to have a question type – Lookup – specified in the Questionnaire.

To automatically relate the record with the questionnaire, set up an On Load rule to assign the ID of the record to the Related to (Lookup) field.

In the application, when opening the entity and choosing the questionnaire, the record will be automatically related.

Show completed inspections on a specific entity

In the previous section, we described how to create a tab on an entity with questionnaire templates. And you can also show completed questionnaires for a specific record on its form.

Example: We have a questionnaire in which it is necessary to choose an account record from the Account entity. This indicates that answers are related to this specific account and it is useful to display the questionnaire on the form of that record.

  1. Make sure the “Lookup” question type is set for the entity in the questionnaire, so users can choose the entity record. You can also set up automatic filling of this field when opening questionnaire from the entity record (see section #Automatically relate questionnaire with entity records).
  2. Add Unrelated List (Questionnaire) to the Edit Form of the entity (Account). Press F2 or use the Rename button to rename the list to “Completed_Questionnaires” or similar.
  3. Double-click or use the Properties button to open the Completed_Questionnaires list properties.
  4. Select only the view used for showing completed questionnaires. Check how to create separate views for questionnaire templates and completed questionnaires in section #Create separate views for questionnaire templates and answered questionnaires
  5. In Properties, click on the Edit Filter button and set up a filter. Add the Link to Questions entity, and add a condition stating that only questionnaires with raw ID value that is the same as the value of the record should be displayed.
  6. Open On Load rule on the entity to ensure that every time the form is loaded, the tab with completed questionnaires is “refreshed” and visible.
  7. Save all the changes, publish them, and test in the application.