Skip to main content

HSD’s Dynamics Technical Consultant – Rohan Perera demonstrates how to create basic and advanced forms.

This post may help Power Apps portals developers who are new to the portal development and starting to create portal pages within the Portal Management app.

What are these forms?

  • Basic Form (formally known as ‘Entity form’)
    This form allows us to display complete Dataverse (Dynamics 365) form within the portal.
  • Advanced Form (formally known as ‘Web form’)
    Allow us to create Web page with steps using the tabs within a Dataverse form.
  1. Creating a Basic Form using existing Dataverse form.
    • Login to dynamics (CRM) as an Administrator
    • Select the Portal menu item at the bottom of the left panel
    • Select Basic form (in Content section) and click ‘+ New’ button
    • Then enter/Select Name, Table Name, Form Name and Website as below:
    • Then click ‘Save & Close’ button.

Description of creating a ‘Web Page’ out of this ‘Basic form’ is in the section 3.

2. Creating an Advanced Form using existing Dataverse form and tabs.

In this section, we are creating an Advanced Form and adding steps to it. Then we define the sequence (Starting step and Next Steps) for these.

  • Select Portal menu item (bottom of the left panel)
  • Select ‘Advanced Form’ (in Content section) and click “+ New” button at the top bar
  • Then enter/Select ‘Name’ and ‘Website’
  • Click Save button
  • Select ‘Advanced Form Steps’ Tab and click “+ New Advanced Form Step” button
  • New ‘Advanced Form Step’ will be displayed
  • Enter/Select ‘Name’ and ‘Target Table Name’
  • Go to the ‘Form Definition’ tab and select ‘Form Name’ and ‘Tab name’ and save and close the step.
  • Repeat (e.) to (h.) until all the steps are added
  •  Open one step at a time and enter the ‘Next step”

Save and close Steps.

  • Add the Starting step to the ‘Advanced Form”

3. Creating a ‘Web Page’ to display in the portal using Basic or Advanced Forms

  • Go to Portal (bottom of the left panel) and select ‘Web Pages’
  • Click ‘+ New’ button in the top bar
  • Enter/Select Name, Website, Parent Page, Partial URL, Page Template, Publishing State as shown below:
  • Please select the created Basic or Advanced form.
  • Save & Close this page
  • Now you can access this page from the portal using above Partial URL

Example:

https://<portalname>.powerappsportals.com/TestPage/

Required fields and Validation Scripts in Basic and Advanced forms

4. Required fields

4.1. Adding required fields process is similar for Basic and Advanced forms.
We need to add metadata (Fields) and specify them as required

Basic Form: Microsoft Help Link:  Configuring basic forms

  • When you opened the Basic form select the ‘Entity Form Metadata’ Tab
  • Click on  “+ New Basic Form Metadata’
  • Select Attribute as the Type and select the attribute
  • Click ‘Field is Required’
  • Save & Close the metadata form.
  • Repeat adding metadata until all required fields added.

Advanced Form: Microsoft Help Link: Configuring Advanced form Metadata.

In this type of forms, you need to add the Metadata for Steps.

  • After you open the Advanced Form, select ‘Advanced Form Steps’ Tab
  • Then open a step
  • Click “Related’ option as below and select Metadata.
  • Then configure the Metadata as same as in Basic forms.
  • Repeat adding metadata until all required fields added.

4.2. Add Regular Expressions to Validate Fields

Use the field metadata (As in above step) to validate portal form fields (like phone numbers, emails etc.) with Regular Expressions.

Example of validating email field:

Examples of Regular Expressions:

  • Four digits postcode: \d{4}
  • Numeric field: \d+

4.3 Web Page Level Scripting

You can add Scripting to show/hide fields/Sections.

Show required fields based on users selection of option sets/Checkboxes etc.

  • Open the Web Page
  • Open the Localized Content page as shown below
  • Go to the Advanced Tab and enter the required script

4.2 Add form level scripting  Microsoft Help Link: Portal Scripting

You can add dynamic validations in response to data entry changes.

Basic Form:

Scripting can be added at the form level.

  • Open the Basic form
  • Select the ‘Additional Settings’ Tab
  • You may have to check the ‘Advanced settings’ check-box displayed in top left corner.
  • Enter required scripting in ‘Custom JavaScript’ section

Advanced Form:

Scripting need to be added for each step.

  • Open the ‘Advanced Form’
  • Go to the ‘Advanced Form Steps’ Tab and open a Step
  • Select the ‘Form Options’ Tab
  • Enter required scripting in ‘Custom JavaScript’ section

5. Login to the Portal (As an Administrator) to add a new Menu Item

  • After you login by a system admin to the Dataverse (Dynamics 365) open a new tab in the browser
  • Enter the portal URL
  • Click Sign in from the top menu
  • Click ‘Azure AD’ button
  • You will be login as a portal Administrator.
  • Move your mouse over the top menu bar
  • Click Edit
  • The Primary Navigation menu will be displayed.
  • Add new menu item using the + button
  • New pop-up screen will be displayed
  • Select the created ‘Web Page’ and save
  • Then save the Menu

Make sure you check out more of HSD’s blog posts by visiting https://www.hsd.com.au/blog/ and follow us on LinkedIn for up-to-date activity from HSD.