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.
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
- Edit an app project.
- Select Inspections in the Project menu.
- Click Add to Home.
- Save everything and publish the app project.
- The home screen menu in the app now includes inspections.
Add to form
- Edit an app project.
- Select Inspections in the Project menu.
- Click Add to Form, then select an entity and click OK.
- Save everything and publish the app project.
- The form of the entity in the app now includes an inspections tab.
Add to form with a custom button
You can add a custom button to the entity form and configure it to open the specific questionnaire template.
In this example, we add a custom button called “Satisfaction Survey” to the Account entity form. Tapping that button opens the Satisfaction Survey questionnaire template.
- Edit an app project in Woodford.
- Select the Account entity from the Project menu and click Show UI to display the list of mobile views, forms, and charts.
- Edit a form and click Add Button to add a button with the following settings:
- Click Button Click and set up the following rule:
- Click (FetchXML) to configure the filter that points to the Satisfaction Survey questionnaire template.
- Save everything and publish the app project.
- Synchronize the app and open any account record. Tap Satisfaction Survey to start the questionnaire.
Another option for adding inspections to a form is to configure a "fake" button that opens a specific questionnaire by formatting the related tab on the entity form.
In this example, we create a fake button called "Repair Form" on the Appointment entity form that opens the "Repair Form" questionnaire template.
- Edit an app project in Woodford.
- Select the Appointment entity from the Project menu and click Show UI to display the list of mobile views, forms, and charts.
- Edit a form, click Add List and select Inspections to add the Inspections tab to the entity form.
- Select the Inspections tab and set the following properties:
Header = Hidden
Height = 1 - Select the Inspections tab and click Properties. On the Associated Views tab select the Templates view and clear all other views, then click Edit Filter.
- In the Edit Filter window delete all the existing filter conditions (if any) and add a single condition Name Equals [name of your questionnaire template].
- Save all changes and publish the app project.
- Synchronize the app and open any appointment record. Tap Repair Form to start the questionnaire.
This approach can be used in more complex scenarios, such as Field Service, where each questionnaire is associated with a specific type of record.
Example: In Dynamics for Field Service a work order form displays a list of associated service tasks; each service task has a certain task type. We will add a button called Inspection to the service task associated view; by pressing this button on the selected service task the questionnaire template associated with a corresponding service task type (see the table below) will automatically open.
Service task type | Questionnaire template |
---|---|
Customer satisfaction | Satisfaction survey |
Perform repair | Repair form |
Standard inspection | Inspection checklist |
High-level steps:
- Create a new N:N relationship in Dynamics.
- Associate the questionnaires with the service task types in Questionnaire Designer.
- Enable the new N:N relationship’s entity in Woodford.
- Add a new button to the associated view in Woodford.
- Configure Button Click rule in Woodford.
Detailed steps:
- In Dynamics, create a new N:N relationship between the entities Questionnaire (resco_questionnaire) and Service Task Type (msdyn_servicetasktype); then save and publish the changes.
- In the Questionnaire Designer associate each questionnaire template with the corresponding service task type using the Associate button based on the table above.
- In the Woodford project, enable the N:N relationship entity created in step 1 and save the changes.
- In the Woodford project, open the appropriate Work Order Service Task entity associated view. Click Buttons, then click New Command and configure a new button called Inspection. Save the command and return to the view.
- Click Button Click to open the rule editor. Configure a simple Button Click rule.
- Configure the following filter in the FetchXML filter window.
- Save all the changes and publish the project.
- Synchronize the app and open any work order with the service tasks associated. Select any service task and tap inspection to open the questionnaire associated with the corresponding service task type.
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 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.
- 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.
See also: Automatically copy answer to a custom field.
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.