Adding questionnaires to app projects

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

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.
    add inspections to home screen menu
  4. Save everything and publish the app project.
  5. The home screen menu in the app now includes inspections.
    inspections on the home screen menu

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.
    add inspections to the form
  4. Save everything and publish the app project.
  5. The form of the entity in the app now includes an inspections tab.
    inspections on the task form
    inspection started from form

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.

  1. Edit an app project in Woodford.
  2. Select the Account entity from the Project menu and click Show UI to display the list of mobile views, forms, and charts.
  3. Edit a form and click Add Button to add a button with the following settings:
    Tap button to start inspection example 1:add custom button
  4. Click Button Click and set up the following rule:
    Tap button to start inspection example 2:button click rule
  5. Click (FetchXML) to configure the filter that points to the Satisfaction Survey questionnaire template.
    Tap button to start inspection example 3:button click rule: fetch for the questionnaire
  6. Save everything and publish the app project.
  7. Synchronize the app and open any account record. Tap Satisfaction Survey to start the questionnaire.
    Tap button to start inspection example 4:click the button on the form Tap button to start inspection example 5:inspection is started

Add to form via related tab formatted as a button

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.

  1. Edit an app project in Woodford.
  2. Select the Appointment entity from the Project menu and click Show UI to display the list of mobile views, forms, and charts.
  3. Edit a form, click Add List and select Inspections to add the Inspections tab to the entity form.
    Add questionnaire to form via related tab formatted as a button 1:add the Inspections tab to the entity form
  4. Select the Inspections tab and set the following properties:
    Header = Hidden
    Height = 1
    Add questionnaire to form via related tab formatted as a button 2:select the Inspections tab and set the following properties
  5. 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.
    Add questionnaire to form via related tab formatted as a button 3:select templates from the associated views
  6. 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].
    Add questionnaire to form via related tab formatted as a button 4:add a following condition in the filter
  7. Save all changes and publish the app project.
  8. Synchronize the app and open any appointment record. Tap Repair Form to start the questionnaire.
    Add questionnaire to form via related tab formatted as a button 5:click the inspection button Add questionnaire to form via related tab formatted as a button 6:inspection is started

Add to form via a related tab button

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:

  1. 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.
    Add questionnaire to form via a related tab button 1: Create N:N relationship(Dynamics)
  2. In the Questionnaire Designer associate each questionnaire template with the corresponding service task type using the Associate button based on the table above.
    Add questionnaire to form via a related tab button 2: associate questionnaire template with the corresponding service task type
  3. In the Woodford project, enable the N:N relationship entity created in step 1 and save the changes.
    Add questionnaire to form via a related tab button 3: enable created N:N relationship in Woodford
  4. 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.
    Add questionnaire to form via a related tab button 4: create a new command
  5. Click Button Click to open the rule editor. Configure a simple Button Click rule.
    Add questionnaire to form via a related tab button 5: configure a simpe button click rule
  6. Configure the following filter in the FetchXML filter window.
    Add questionnaire to form via a related tab button 6: configure the fetchXML filter
  7. Save all the changes and publish the project.
  8. 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.
    Add questionnaire to form via a related tab button 7: click the button to start the inspection Add questionnaire to form via a related tab button 8: inspection is started

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.

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.

  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.