Adding questionnaires to app projects
If you are using Resco Mobile CRM as your app with Resco Inspections, you need to add questionnaires to your app projects.
You can either use the out-of-the-box integration (recommended), or you can use the instructions in this article to create custom integration.
- 1 Create separate views for questionnaire templates and answered questionnaires
- 2 Distinguish partially answered (saved) questionnaires and completed questionnaires
- 3 Use questionnaires on a specific entity
- 4 Show only questionnaire templates on certain entity
- 5 Automatically relate questionnaire with entity records
- 6 Show completed inspections on a specific entity
Create separate views for questionnaire templates and answered questionnaires
Administrators can create custom views via Woodford:
- Choose the Questionnaire entity from the Project menu in Woodford.
- Click Show UI, then click New View.
- Rename the view so it is clear whether it is for templates or answered questionnaires.
- Open the view and edit its filter:
- For templates, add condition "Is Template Equals Yes".
- For answered questionnaires, add condition "Is Template equals No".
- Once the view is created, save the changes, publish and sync the application.
- 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
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
|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.
- Choose an entity in the Woodford entity menu.
- Open its edit form.
- Click on Add List.
- 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.
- 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).
- 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.
- Double-click or use the Properties button to open the Completed_Questionnaires list properties.
- 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
- 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.
- 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.
- Save all the changes, publish them, and test in the application.