Jump to content

Resco Inspections on Power Platform: Difference between revisions

From Resco's Wiki
Created page with "{{Inspections TOC}} {{WIP}} Traditionally, end users consume questionnaires in Resco mobile apps. Since Release 16.1 (summer 2023), questionnaires..."
 
Line 63: Line 63:
== Power Pages ==
== Power Pages ==


Microsoft Power Pages is a platform for creating, hosting, and managing websites. The following example explains how to include the Questionnaire Player on a webpage.
Microsoft Power Pages is a platform for creating, hosting, and managing websites. The following example explains how to include the Questionnaire Player on a webpage in 3 steps:
* Create a Power Page and add the Questionnaire Player
* Set up permissions for tables necessary for the Questionnaire Player
* Grant web API access for the same tables


=== Create a Power Page ===
# Go to https://make.powerpages.microsoft.com/ (Power Pages design studio).
# Ensure you are in the environment with Resco Woodford solution installed.
# Create a new power page or edit an existing one.
# Go to '''Pages''' and select the page where you want to add the Questionnaire Player.
# Insert an iframe to the page, then switch to '''Edit code''' and use the following code to define the iframe content:<br><code><nowiki><iframe frameborder="0" id="qplayerIFrame" data-ppid="1565191e-bc3e-7bad-6805-6ffd20a70b42" style="width: 800px; height: 800px; max-width: 100%;"></iframe></nowiki></code>
# Include the following script within the page:<br><code><nowiki><script type="text/javascript" src="/_webresource/resco_MobileCRM/PowerPages/inspectionsPlayer.js" data-ppid="3699bcda-72e0-21e0-94cb-71dee05f0691"></script></nowiki></code>
# Save the modified code, return to Power Page design studio, and click '''Sync''' to retrieve the latest code.
<!--
<!--
{{Note|The id in the iframe represents the id of the guide. Replace the id with a guide id that exists in your environment.}}-->
=== Set up table permissions ===
=== Set up table permissions ===


While editing your site, go to '''Set up > Table permissions''' and add permissions for seven+ tables:
Add the necessary permissions for the following tables:


* resco_mobileproject – Read access
* resco_mobileproject – Read access
Line 77: Line 91:
* annotation – Read, Write, Update, Delete, Append, Append to
* annotation – Read, Write, Update, Delete, Append, Append to
* systemuser – Read, Append, Append to
* systemuser – Read, Append, Append to
* webresource – Read, Append, Append to
* Any entity accessible from your questionnaires (e.g., account, contact…)
* Any entity accessible from your questionnaires (e.g., account, contact…)


You can decide what kind of access you want to grant users. It can be accessed by anonymous users or authenticated users. The access type might be global or parent, account, or contact. You can learn more about the security model of power pages in official MS documentation. In this document, we describe how to grant access to the mentioned tables for anonymous users.
You can decide what kind of access you want to grant users. Your web can be accessed by anonymous users or authenticated users. The access type might be global or parent, account, or contact. You can learn more about the security model of power pages in official Microsoft documentation. In this document, we describe how to grant access to the mentioned tables for anonymous users.


For each table, repeat the following procedure:
While editing your site, go to '''Set up > Table permissions'''. For each table, repeat the following procedure:
# Click '''+New'''.
# Click '''+New'''.
# Enter the Name of your permission, Website, and the Table Name.
# Enter the '''Name''' of your permission, '''Website''', and the '''Table Name'''.
# Set the Global value for the Access Type field.
# Set '''Access Type''' to "Global".
# Check the required privileges.
# Check the required privileges, for example, '''Read'''.
# After saving the Table setting, stay on the form and add the Web Role for which the permission is created. In our case, it is Anonymous Users.
# Click '''Add roles''' and check role(s) for which the permission is created. In our case, it is '''Anonymous Users'''.
# Save all changes.
# Save all changes.
[[File:Add-table-permissions-for-power-pages.png|600px]]


=== Set up web API access ===
=== Set up web API access ===
Line 93: Line 110:
Questionnaire Player uses Microsoft Web API service to communicate with the underlying Dataverse organization. You must set the Web API access to the same tables as in the previous step.
Questionnaire Player uses Microsoft Web API service to communicate with the underlying Dataverse organization. You must set the Web API access to the same tables as in the previous step.


# Return to the Power Pages home page (list of your sites).
# While editing your site, click the ellipsis button in the left pane (just under Set Up) and select '''Portal Management'''.
# On the tile of your site, click the ellipsis button and select '''Portal management'''.
# Select '''Website > Site Settings''' from the menu.
# Select '''Website > Site Settings''' from the menu.
# For each table, create two new site settings:
# For '''each table''', create two new site settings:
#* Enable the web API for this table.
#* Enable the web API for this table.
#* Set up fields that should be available via web API (or use asterisk for all).
#* Set up fields that should be available via web API (or use asterisk for all).
[[File:Set-web-API-access-in-site-settings.png|600px]]
<!--


=== Create a Power Page ===
=== Create a Power Page ===

Revision as of 09:20, 11 September 2023

Warning Work in progress! We are in the process of updating the information on this page. Subject to change.

Traditionally, end users consume questionnaires in Resco mobile apps. Since Release 16.1 (summer 2023), questionnaires can also be used in various components of the Microsoft Power Platform: Power Apps and Power Pages.

As your backend server, use Microsoft Dataverse - with or without extra Dynamics features.

Prerequisites

Here's a high-level overview of steps to prepare your environment:

  1. Go to https://make.powerapps.com/.
  2. Install the Woodford managed solution. (How?)
  3. Use the Questionnaire Designer to create and publish at least one questionnaire.
Preview Inspections on Power Platform are still in preview. In step 2, don't install the production version of the Woodford solution released earlier this year. Instead, see the Preview page for a newer version.

Why Woodford

In this scenario, the Woodford tool is not used. So why is the Woodford solution needed? It includes several other components necessary for inspections:

  • Custom tables, e.g., questionnaire
  • Questionnaire Designer, the backend tool for designing and managing questionnaire templates
  • Several standard views for the questionnaire table, as well as a custom form - the Questionnaire Player web resource. These can be used on the Power Platform.

Power Apps

The Questionnaire table can be easily integrated into your Power Apps with only a few clicks. Treat Questionnaire just like a standard Dataverse table, with the Questionnaire player replacing the standard table form.

Power Pages

Microsoft Power Pages is a platform for creating, hosting, and managing websites. The following example explains how to include the Questionnaire Player on a webpage in 3 steps:

  • Create a Power Page and add the Questionnaire Player
  • Set up permissions for tables necessary for the Questionnaire Player
  • Grant web API access for the same tables

Create a Power Page

  1. Go to https://make.powerpages.microsoft.com/ (Power Pages design studio).
  2. Ensure you are in the environment with Resco Woodford solution installed.
  3. Create a new power page or edit an existing one.
  4. Go to Pages and select the page where you want to add the Questionnaire Player.
  5. Insert an iframe to the page, then switch to Edit code and use the following code to define the iframe content:
    <iframe frameborder="0" id="qplayerIFrame" data-ppid="1565191e-bc3e-7bad-6805-6ffd20a70b42" style="width: 800px; height: 800px; max-width: 100%;"></iframe>
  6. Include the following script within the page:
    <script type="text/javascript" src="/_webresource/resco_MobileCRM/PowerPages/inspectionsPlayer.js" data-ppid="3699bcda-72e0-21e0-94cb-71dee05f0691"></script>
  7. Save the modified code, return to Power Page design studio, and click Sync to retrieve the latest code.

Set up table permissions

Add the necessary permissions for the following tables:

  • resco_mobileproject – Read access
  • resco_mobiledata – Read access
  • resco_questionnaire – Read, Write, Update, Delete, Append, Append to
  • resco_questiongroup – Read, Write, Update, Delete, Append, Append to
  • resco_question – Read, Write, Update, Delete, Append, Append to
  • annotation – Read, Write, Update, Delete, Append, Append to
  • systemuser – Read, Append, Append to
  • webresource – Read, Append, Append to
  • Any entity accessible from your questionnaires (e.g., account, contact…)

You can decide what kind of access you want to grant users. Your web can be accessed by anonymous users or authenticated users. The access type might be global or parent, account, or contact. You can learn more about the security model of power pages in official Microsoft documentation. In this document, we describe how to grant access to the mentioned tables for anonymous users.

While editing your site, go to Set up > Table permissions. For each table, repeat the following procedure:

  1. Click +New.
  2. Enter the Name of your permission, Website, and the Table Name.
  3. Set Access Type to "Global".
  4. Check the required privileges, for example, Read.
  5. Click Add roles and check role(s) for which the permission is created. In our case, it is Anonymous Users.
  6. Save all changes.

Set up web API access

Questionnaire Player uses Microsoft Web API service to communicate with the underlying Dataverse organization. You must set the Web API access to the same tables as in the previous step.

  1. While editing your site, click the ellipsis button in the left pane (just under Set Up) and select Portal Management.
  2. Select Website > Site Settings from the menu.
  3. For each table, create two new site settings:
    • Enable the web API for this table.
    • Set up fields that should be available via web API (or use asterisk for all).



{{#CI form: title = Was this information helpful? How can we improve? | type = inputs | [textarea] }}