Skip to main content

Maptaskr for Power Pages Setup

Upload Solution Files

To upload solution file to your portal, navigate to Portal/Power Pages Management App.

  1. To do this, click on the Application name in the Dynamics top ribbon next to the Dynamics 365 title as highlighted below.

    A list of all available applications will be displayed. Please note that your list may not match the example below. Click on Portal/Power Pages Management.

    Figure 30: Portal/Power Pages Management App

  2. Open Web Files under the Content section

    Figure 31: Portal/Power Pages Management Web Files

    A screenshot of a computer

  3. Create a New record with the following details:

    Table 3: Create new Web File
    ColumnValue
    Nameinitmap.js
    Website*Select your portal website here*
    Parent PageHome
    Partial URLinitmap.js
    Publishing StatePublished
  1. Save the record and then select the Notes tab.

    Figure 32: Add initmap.js note.

    Graphical user interface, text, application, email

  2. In the Timeline control, click on the paperclip icon to upload a file.

    Figure 33: Add note attachment.

    Graphical user interface, text, application, email

  3. Upload the file described in the table below. Save and close the record.

    Table 4: Solution Files to Upload
    File NameTypeSource
    initmap.jsJavaScriptInitMap Source

Entity Lists

Maptaskr Entity Lists are required to be added. To add the relevant Lists

  1. Navigate to Lists under the Content section.

    Figure 34: Portal/Power Pages Management Lists

    The following entities needs to be created and enabled under Entity Lists -

    Table 5: Entity Lists to Configure
    NameInternal NameViewPage Size
    Maptaskr Configuration ListMaptaskr_configurationActive Configurations10,000
    Maptaskr Lambpet ListMaptaskr_lambpetActive Lambpets10,000
  2. Click New to get the New List form. Populate the details as shown below.

    Figure 35 – New Maptaskr Configuration List

    Graphical user interface, text, application

    note

    The website name here will be the website you are installing Maptaskr on.

  3. Then to add a view click on the + View button as highlighted below. A new entry will appear and auto-populate with the default view for that table.

    Figure 36: New List +View Configuration

    Graphical user interface, text, application Graphical user interface, application

  4. Scroll down to the Page Size column and set this one according to the table above.

    Figure 37: List Page Size Configuration

    Graphical user interface, text, application, email

Site Settings

Maptaskr Site Settings are required to be added to the portal. To add the relevant Site Settings:

  1. Navigate to Site Settings under the Website section.

  2. Add the following Site Settings to enable communication with the entities -

    Table 6: Site Settings
    NameValue
    Webapi/annotation/enabledtrue
    Webapi/annotation/fields*
    Webapi/maptaskr_configuration/enabledtrue
    Webapi/maptaskr_configuration/fields*
    Webapi/maptaskr_lambpet/enabledtrue
    Webapi/maptaskr_lambpet/fields*
    Webapi/maptaskr_layergroup/enabledtrue
    Webapi/maptaskr_layergroup/fields*
    Webapi/maptaskr_layers/enabledtrue
    Webapi/maptaskr_layers/fields*

    An example of how to populate this record is shown below.

    Figure 38: New Site Setting - Example

    Graphical user interface, text, application, email

Web Roles

Web Roles are required to ensure that portal users have permission to map related tables. Newly registered users should be configured to automatically be assigned to the below Web Role(s), this needs to be performed by a Power Apps Administrator. For more information, please refer to the Microsoft documentation for Creating and assigning a Web Role.

Navigate to Web Roles under the Security section.

Figure 39.1: Add Web Role

A screenshot of a computer

The following web role needs to be added/created:

Table 8: Web API User
PropertyValue
NameWeb API User
Authenticated Users RoleYes
Anonymous Users RoleNo
Figure 39.2: New Web Role Creation

Graphical user interface, text, application, email

Once you've entered the detail save and close the new active web role.

Table Permissions

Navigate to Table Permissions under the Security section. From here you will need to create various table permissions as shown below.

Figure 40: Table Permissions

Figure 41: New Table Permissions screen

Graphical user interface, text, application, email

The following five (5) table permissions are required to be created:

  • Annotation Permission
  • Lambpet Permission
  • Maptaskr Configuration Permission
  • Maptaskr Layer Group Permission
  • Maptaskr Layer Permission
note

When creating table permissions, the ability to add Web Roles is only available after saving the record.

The table below gives an overview of the settings required for each table permission.

Table 9: Table Permissions Overview
NameTable NameAccess TypePrivilegesWeb Roles
Annotation PermissionannotationGlobalRead, Write, Create, Delete, Append and Append ToWeb API User
Lambpet Permissionmaptaskr_lambpetGlobalRead, Write, Create, Delete, Append and Append ToAuthenticated Users, Web API User
Maptaskr Configuration Permissionmaptaskr_configurationGlobalReadWeb API User
Maptaskr Layer Group Permissionmaptaskr_layergroupGlobalReadWeb API User
Maptaskr Layer Permissionmaptaskr_layersGlobalReadWeb API User

Add Table Permissions to Web Roles

Once the permissions in section Table Permissions have been created, they are required to be added to the Web API User previously created.

  1. Head back to Web Roles and select the Web API role.

    Figure 42: Add Table Permissions to Web Role.

    A screenshot of a computer

  2. From here go to the Related tab section and select Table Permissions

  3. Add the following permissions to Web API User as shown in Figure 42: Add Table Permissions to Web Role

    • Annotation Permission,
    • Case Permission,
    • Lambpet Permission,
    • Maptaskr Configuration Permission,
    • Maptaskr Layer Group Permission and
    • Maptaskr Layer Permission

Web Templates

Navigate to Web Templates under the Content section. Here you will need to create multiple Web Templates as shown below.

Figure 43: Maptaskr Web Templates

The table below shows Maptaskr Web Templates to add, including the name and source of each of the Maptaskr Web Templates that are required to be created. Please note that there are some specific considerations for the Maptaskr Custom Layer Search template detailed in the Maptaskr Custom Layer Search section.

Table 10: Maptaskr Web Templates to add.
Web Template NameSource
Maptaskr Custom Layer SearchSee Appendix A: Web Templates
Maptaskr Lambpet Search
Maptaskr Layer Group Search
Maptaskr Related Shape Search
Maptaskr Shape Search
Maptaskr Dataverse Layer
Figure 44 – Web Template example source record.

Graphical user interface, application

Due to differences between the Maptaskr Layer table that comes with the Maptaskr Core solution you will need to be mindful of the following fields in your template.

  • Core Solution version 2.2.1.58 and earlier DO NOT INCLUDE Static Token OR Additional Parameter fields in your template.
  • Core Solution version 2.2.1.59 up to 2.2.1.63 DOES NOT INCLUDE Additional Parameters field in your template.
  • Core Solution version 2.2.1.64 and up you can use both fields in your template without issue.

Updating other Web Templates

The following information applies to out of the box installations of the Power Apps Power Pages/Portals.

note

Please keep in mind that if you have a highly customized setup, Power Apps Administrators will need to configure Web Templates for Maptaskr. This can be done by updating the default Web Templates or by creating new Web Templates for specific forms.

  1. Navigate to the Active Web Templates list under the Content section.

    Figure 45: Edit Web Template

  2. Edit Full Page without Child Links

    A screenshot of a computer

  3. Update the following template source to include reference to initmap.js–

    note

    Replace only the highlighted area with correct reference filename.

    <script 
    src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"
    type="text/javascript">
    </script>
    <script
    src="/initmap.js"
    type="text/javascript">
    </script>

Page Templates

The following five (5) Maptaskr Page Templates are required to be created;

  • Maptaskr Custom Layer Search
  • Maptaskr Lambpet Search
  • Maptaskr Shape Search
  • Maptaskr Layer Group Search
  • Maptaskr Related Shape Search
note

Please ensure you untick the "Use Website Header and Footer" checkbox when creating the Page Templates.

Graphical user interface, application Description automatically generated

  1. Navigate to Page Templates under the Website section and click New to create the Page Templates as specified in Table 11: Maptaskr Page Templates.

    Figure 47: Page Templates

    A screenshot of a computer

    Table 11: Maptaskr Page Templates
    NameTypeWeb TemplateUse Website Header and Footer
    Maptaskr Custom Layer SearchWeb TemplateMaptaskr Custom Layer SearchFalse
    Maptaskr Lambpet SearchWeb TemplateMaptaskr Lambpet SearchFalse
    Maptaskr Shape SearchWeb TemplateMaptaskr Shape SearchFalse
    Maptaskr Layer Group SearchWeb TemplateMaptaskr Layer Group SearchFalse
    Maptaskr Related Shape SearchWeb TemplateMaptaskr Related Shape SearchFalse

Web Pages

The following five (5) Maptaskr Web Pages are required to be created;

  • Maptaskr Custom Layer Search
  • Maptaskr Lambpet Search
  • Maptaskr Shape Search
  • Maptaskr Layer Group Search
  • Maptaskr Related Shape Search
  1. Navigate to Web Pages under the Content section. Click Add and create the required pages as outlined in Table 12: Maptaskr Web Pages to create.

    Figure 48: Maptaskr Web Pages

    Table 12: Maptaskr Web Pages to create.
    NameParent PagePartial-URLPage TemplatePublishing State
    Maptaskr Custom Layer SearchHomecustom-layer-searchMaptaskr Custom Layer SearchPublished
    Maptaskr Lambpet SearchHomemaptaskr-lambpet-searchMaptaskr Lambpet SearchPublished
    Maptaskr Shape SearchHomemaptaskr-shape-searchMaptaskr Shape SearchPublished
    Maptaskr Layer Group SearchHomemaptaskr-layergroupsMaptaskr Layer Group SearchPublished
    Maptaskr Related Shape SearchHomemaptaskr-related-shape-searchMaptaskr Related Shape SearchPublished

Advanced/Multistep & Basic Forms

To enable shape submission functionality from the Maptaskr PCF in forms, a small JavaScript code snippet needs to be included as part of the form step question.

note

Forms within Dynamics 365 needs to be configured, and a new section needs to be created. For more details, please refer to Table Setup. The following sections provide an overview of where and how to add the code snippet to either a Basic or Multistep form.

info

Due to the way Power Pages/Portals are architected, maps requiring data submission in a create scenario need to be placed in a subsequent step to ensure that the map has access to the record's newly generated GUID to create the neccessary relationship connections.

In the case of Basic Forms, this will require a separate form.

In the case of Advanced/Multistep Forms, this will require a new form step.

Basic Form – (Create & Edit)

Navigate to the Basic Form you are wanting to configure by Going to Basic Forms and clicking on the form listed. For the below example we will be using the simple contact us form.

Figure 49: Basic Form

A screenshot of a computer Description automatically generated

  1. From the ribbon menu click on Additional Settings and scroll down to the Custom JavaScript section at the bottom of the page.

    Figure 50: Basic Form Additional Settings

    A screenshot of a computer Description automatically generated

  2. In the Custom JavaScript section paste in the following code snippet found at Appendix B: Custom Javascript, and click Save.

    Figure 51: Insert Custom JavaScript

    A screenshot of a computer

Advanced/Multistep Form (Create & Edit)

Navigate to the Multistep Form you are wanting to configure by going to Multistep Forms. For this example we will be showing the Account Create Form that has a map control on the Location form step.

Figure 52: Multistep Form 1.

  1. From the ribbon menu click on -> Form Steps and select the Name of the form step you will have the PCF control embedded.

    Figure 53: Multistep Form – Form Steps

  2. Once in the step, click on the Form Options ribbon options and scroll down to the Custom JavaScript section where you will need to insert the code snippet found at Appendix B: Custom Javascript, and click Save.

    Figure 54: Insert Custom JavaScript

Basic/Advanced Form Metadata

Once table columns have been set up and configured as per Table Setup, it is important to add Form Metadata in the Portal/Power Pages Management app. For the relevant Basic Form or Advanced Step Form (If you don't see the Metadata tab, click on Related or the three-dot icon), create a new record and enter the following details:

Basic Form

Navigate to the Basic Form you are wanting to configure by Going to Basic Forms and clicking on the form listed. For the below example we will be using the simple contact us form.

Figure 55: Basic Form - Basic Form Metadata

A screenshot of a computer Description automatically generated

  1. Click on the + New Basic Form Metadata button.

    Figure 56: New Basic Form Metadata

    A screenshot of a computer Description automatically generated

  2. Fill in the details according to Table 13: Basic Form Metadata details and click Save.

    Figure 57: Create New Basic Form Metadata

    A screenshot of a computer Description automatically generated

    Table 13: Basic Form Metadata details
    PropertyValue
    Basic Form<Name of your Basic Form>
    TypeAttribute
    Control StyleCode Component
    Attribute Logical NamePCF Bind Field as configured in Table Setup

Advanced Form

Navigate to the Multistep Form you are wanting to configure by going to Multistep Forms. For this example, we will be showing the Account Create Form that has a map control on the Location form step.

Figure 58: Multistep Form

A screenshot of a computer Description automatically generated

  1. From the ribbon menu click on -> Form Steps and select the Name of the form step you will have the PCF control embedded.

    Figure 59: Multistep Form – Form Steps

    A screenshot of a computer Description automatically generated

  2. Click on Related in the ribbon and select Metadata.

    A screenshot of a computer Description automatically generated

  3. Click on the + New Basic Form Metadata button.

    Figure 60: New Multistep Form Metadata

  4. Fill in the details according to Table 14: Multistep Form Metadata Details details and click Save.

    Figure 61: Create New Multistep Form Metadata

    Table 14: Multistep Form Metadata details
    PropertyValue
    Form Step<Enter the name of your Form Step>
    TypeAttribute
    Control StyleCode Component
    Attribute Logical NamePCF Bind Field as configured in Table Setup

InitMap.js

The initmap JavaScript file is the bridge between form submission and Maptaskr.

The saveAnnotationsAndShapes method is executed upon clicking the submit button. This function first validates the submission via the validateAnnotationsAndShapes function, which in turn calls the clientValidationFunction, checking for any intersections or exclusions. If validation fails an exception is thrown, the submission is cancelled, and an error message is displayed to the user.

After the validation is successful the saveAnnotationsAndShapes function performs the saving/updating/deleting of submission data in addition to the out-of-the-box save functionality.

This file can be tweaked to your requirements. We recommend modifying the variables and clientValidationFunction at the start of the file to suit your needs. If necessary other functions in initmap can be modified for advanced requirements, though this is not recommended for most applications.

A screenshot of a computer program Description automatically generated

The start of the file contains variables that can be changed to suit your requirements. These are:

  • maptaskrEntityDefinition – This is an array of objects that is used to configure entity names when writing Maptaskr Lambpet data back to Dynamics 365 during submission. Each object contains 4 parameters:

    • pathName – The partial URL of the page that the PCF control is loaded on.
    • relationshipName – The schema name of the lookup field related to your entity configured within Maptaskr Lambpet, please note that this field is case sensitive.
    • entityName – The schema name of the entity, please note that this field is case sensitive.
    • entityPluralName – The plural name of the entity, please note that this field is case sensitive.
  • onValidateFailErrorMessage – If the validation of the submission were to be unsuccessful, this will be the validation error message displayed to the end user.

  • onUploadFailErrorMessage – If any step of the upload process were to be unsuccessful, this will be the error message displayed to the end user.

  • onIntersectionMessage – If the users uploaded or drawn shapes and annotations fail the intersection or exclusion tests against configured layers, this will be the error message displayed to the user.

  • clientValidationFunction – If custom validation is required it can be implemented here. The Maptaskr scripts will invoke this function during validation when the user submits. The function should throw an error if validation fails or do nothing if validation passes. The Maptaskr scripts will handle any errors thrown, cancelling saving and navigation if any errors are thrown.

tip

If you have included initmap.js into your form submission and are seeing a 500 error response and the payload contains undefined or null refences like the example below, then you need to ensure that your maptaskrEntityDefinition table is set up correctly.

undefined@odata.bind: "/null(<guid>)"

This error and payload indicates that initmap.js was unable to find a relevant maptaskrEntityDefinition based on the partial URL of the submission web page, and you need to ensure that the entity names have been correctly configured.