FacebookLinkedInTwitter

How to dynamically filter Questionnaire templates on the Appointment entity form based on Appointment Type

laptop checklist calculator coffee hands holding a phone
FacebookLinkedInTwitter

Collecting information in the field, in most use cases you expect a certain type of questionnaire to be available in certain situations and not in others. To enable this in Resco Inspections, we have introduced an option to associate a questionnaire template.

The general idea is that – when integrating Resco Inspections with Microsoft Dynamics 365/CRM – you can use many-to-many relationships to associate a questionnaire with an entity. The many-to-many relationship connects the questionnaire template to the actual record, so this defines which template belongs to which record.

We know that it’s always better to show than just to talk about it, so we’ve prepared the following detailed example.

This example demonstrates how easily you can configure multiple components in order to dynamically display the Questionnaire Templates based on the selected Appointment Type. Let’s assume we have three Appointment Types (Inspection, Repair, Maintenance) and three Questionnaire Templates.

Our goal is to make sure that for the “Inspection” appointment two templates are displayed, for the “Repair” appointment one template is displayed and for the “Maintenance” appointment no template is displayed.

Prerequisites:

  • Dynamics 365/CRM System Administrator/Customizer security role is required
  • Current version of the Woodford solution must be imported in Dynamics 365/CRM
  • Resco Inspections feature must be enabled in the Woodford customization tool
  • Resco Inspections trial or real licence (Inspector and SuperUser) is obtained
  • “Appointment Type” is a separate entity, not just an option-set field on the Appointment entity
  • There is a 1:N relationship between “Appointment Type” entity and “Appointment” entity – in other words, there must be an “Appointment Type” lookup on the “Appointment” entity

High level steps:

    1. Create a new N:N relationship in Dynamics 365/CRM
    2. Associate the Questionnaire Templates with the Appointment Types in the Questionnaire Builder
    3. Perform customizations in the Woodford tool
    4. Sync the Resco mobile app and check if the templates are displayed dynamically

Detailed steps:

A) Create a new custom N:N relationship between the Questionnaire and the Appointment Type entities. In order to do that, go to Dynamics 365/CRM, open the top menu and navigate to Settings. In Customization section select Customizations and click on the Customize the System item. A new window showing the default solution appears:

  1. In the left panel expand the Entities item to display all Dynamics entities
  2. Locate the Appointment Type entity and expand it to display all sub-components
  3. Click on the N:N Relationships item
  4. Click on the New Many-to-Many Relationship button -> a new Relationship window appears
  5. In the Other Entity section select “Questionnaire” in the Entity Name dropdown menu
  6. In the Relationship Definition section type in the Name and Relationship Entity Name (or just leave the default texts)
  7. Click Save and Close button
  8. Click Publish All Customizations button and wait until the changes are published

01
B) Associate each Questionnaire Template with the corresponding Appointment Type. In order to do that, go to Dynamics 365/CRM, open the top menu and navigate to Settings. In MobileCRM section select Inspections and click on the Builder item. A new window called Resco Questionnaire Builder appears:

  1. Select a Questionnaire Template
  2. Click on the Associate button to open the Associate dialog
  3. Click on the Add button to open the Select Entity dialog
  4. Select a corresponding Appointment Type from the list
  5. Click on the OK button to confirm the selection
  6. Close the Associate dialog by clicking on the OK button

In this example we’ve associated two templates with “Inspection” and one template with “Repair”; there is no template associated with the “Maintenance” type of appointment.
02
C) Customize and configure the Resco mobile app using the Woodford tool. In order to do that, go to Dynamics 365/CRM, open the top menu and navigate to Settings. In MobileCRM section select Woodford and click on the MobileCRM Woodford HTML5 item. A new window called Woodford appears showing the list of available mobile projects (if there are any).

  1. Select your preferred mobile project or create a new one by clicking on the New button -> fill in the New Mobile Project form:
    • Type = Standard User
    • Template = Default
    • Name = Inspections (or anything meaningful)
    • Priority = 1 (but if you already have any other mobile project, select a higher number than the existing project has)
    • Roles – select a corresponding security role for your user (make sure the security role has all necessary privileges also for the custom entity Appointment Type)
    • Click Save to close the form

03

  1. Open the mobile project selected/created in step 1. In the left panel select the Inspections item and check the Enable Inspections checkbox. When confirmation pop-up appears, select the “I Confirm this Organization has the appropriate license” option and save the changes.

04

  1. Refresh the web browser and re-open the mobile project. In the left panel locate and double-click the Questionnaire item to show the pre-defined views. In the top menu click on the New View button and fill the New View form:
    • Name = Associated Questionnaires
    • Type = Associated List
    • Template = empty
    • Hidden = unchecked
    • click OK -> View Designer appears -> in the top menu click Save & Close button

05

  1. In the left panel select the Questionnaire item, locate and check the Status Reason field in the list of available fields and save your changes:

06

  1. In the left panel locate and select the N:N relationship entity that you’ve configured in step A.6. In this example it’s called “new_appointmenttype_questionnaire” and it’s greyed out. In the top menu click on Enable button to activate this entity and then click on Save button:

09

  1. In the left panel locate and select an Appointment Type item (which is greyed out), in the top menu click on Enable button to activate this entity and then click on Save button:

07

  1. In the left panel select an Appointment item, locate and check the Appointment Type lookup field (not the option set!) in the list of available fields and save your changes:

08

  1. In the left panel double-click the Appointment item to show the pre-defined form, views and charts. Double-click the Default form to open the Form Designer. In the top menu click on the Add Field button and select the Appointment Type to add this field on the form. Then you can adjust the location of this field by using the Move Up and Move Down buttons. Click on the Save button to save your changes (do not close the Form Designer).

10

  1. In the top menu click on the Add List button and select the Unrelated Entity List option. In the Template dropdown menu select the Questionnaire [resco_questionnaire] option and click OK.

11

  1. Select the newly created tab called Questionnaires List (*), in the top menu click on the Rename button, change the name to “Questionnaire Templates”, click OK and save your changes (do not close the Form Designer).

12

  1. Select the renamed tab Questionnaire Templates and in the left Properties menu change the Height to 5. Then in the top menu click on the Properties button. Make sure that only the Associated Questionnaires view (created in step C.3.) is checked, uncheck any other views. Then click on the Edit Filter button to set up the filter that will ensure that only the questionnaire templates associated with the selected Appointment Type are displayed.

13

  1. Configure the filter according to the screenshot below:
    • add the condition Is Template = Yes
    • add link for the N:N relationship entity created in step A. (in this example it is called “new_appointmenttype_questionnaire (resco_questionnaireid)”) and make sure this L0 link is defined as “outer”
    • add link for the Appointment Type entity (in this example it is called “new_appointmenttypeid”) and make sure this L1 link is defined as “inner”
    • add condition L1.Appointment Type = new_appointmenttypeid (select this via Variable button)
    • click Save & Close to save your changes and close the Edit Filter and Properties windows

14

  1. On the Appointment form in the top menu click on the On Changed button in order to configure a simple rule to ensure that the Questionnaire Templates tab is refreshed when user changes the Appointment Type (see the screenshot below):
    • add condition If ChangedItem = new_appointmenttypeid
    • add step Tabs.Questionnaire Templates.IsLoaded = True
    • click Save & Close button to save your changes and close the Rules Editor

15
16

  1. On the Appointment form click the Save & Close button to save your changes. Then in the top menu click the Publish button to publish the whole mobile project.

17
D) Sync the Resco MobileCRM app using your Dynamics 365/CRM credentials, then in the left menu navigate to Activities and create a new appointment.
If you select the Appointment Type = Inspection, there are two templates available in the Questionnaire Templates section.
18
If you select the Appointment Type = Repair, there is one template available in the Questionnaire Templates section.
19
If you select the Appointment Type = Inspection, there are two templates available in the Questionnaire Templates section.
20
And that’s it!
If you have any questions, don’t hesitate to contact us through Resco Support portal.

FacebookLinkedInTwitter