Customer Engagement & Dynamics CRM Forum

 View Only


By Jandost Khoso posted Mar 26, 2019 09:32 AM


Part 1: Demystifying Dynamics Portals Project – Analysis and Design

In the part 1 of the series, I shed light on some of planning and analysis activities involved in a Portal project. From this part, I will be writing about some common portal project requirements and the way I have addressed those requirements.

Site Settings

One of the most basic portal configurations happen in Site Settings. Site Settings contain some global configuration used by portal framework. The complete list of portal site settings can be found here. However, there are some settings are deprecated since this link is taken from ADXStudio product and there are some settings that you will not find in the given link and I am listing down those settings in the below table:




A true or false value. If set to false will disable the search functionality from the portal so you will not see the magnifier sign on the primary navigation


The format you want to show dates in your portal. For example, for British datetime format, I use d/M/yyyy


A true or false value. If set to true will force user to update their profile after signup. It means portal will redirect the user to the Profile page after successful signup


A true or false value. If set to true, the portal will display the terms and conditions of the site. Users must agree to the terms and conditions before they are considered authenticated and can use the site.


A true or false value. If set to false and profile page is disabled on the Portal, then Redeem Invitation workflow doesn't work properly and keeps redirecting user to same page in place of home page.

From <> 


If a portal only requires a single external identity provider, this allows the Sign-In link on the primary navigation to link directly to the sign-in page of that external identity provider


A true or false value. If set to true allows any anonymous visitor to the portal to create a new user account.


A true or false value. If set to false, it hides the marketing preferences area in the contact profile

Profile page

Profile page is a custom aspx page which displays Contact entity's "Profile Web Form" on the profile page. If you want to change the fields on this page, you must modify "Profile Web Form" on the contact entity. In addition of fields on the "Profile Web Form", the profile pages show Marketing Preferences. Marketing Preferences can be enabled or disabled by using Profile/ShowMarketingOptionsPanel site setting.

Customising Profile Page

Profile page is a special page which you cannot customise using Entity forms and Metadata. An ordinary web page like a case form in portal rely on "Entity Forms". The case of Profile page is different. The Profile page does not rely on Entity forms, but it re-writes the request to "Profile.aspx". So, in case if you want to change the form behavior or add validation to fields on the screen, you will need to come with a different approach.


  1. The mobile phone on the profile should be in the format xxxx-xxx-xxx
  2. The profile page should be editable if the contact has NO active cases
  3. The profile page should be read-only if the contact has active cases


  1. Deactivate the existing Profile web page
  2. Create a new Entity Form called "Editable Profile Entity Form" interfacing "Profile Web Form" in Edit mode
  3. Create a new Entity Form called "Read-only Profile Entity Form" interfacing "Profile Web Form" in Read-only mode
  4. Create a new Web Template called "Profile Web Template" - We will talk about this template in details later
  5. Create a new Page Template named "Profile"
  6. Open the Profile Page template and set the following values
    1. Type=Web Template
    2. Entity Name= Web Page (adx_webpage)
    3. Web Template = Profile Web Template (created in the step 4)
  7. Create a new Web Page named "Profile".
    1. The profile page's partial URL must be "Profile"
    2. Set the parent page to "Home".
    3. Set the Page Template to the Profile Template (created on the step 6)
  8. Open the Profile Web Template and add the following liquid template:

For adding the breadcramp, add the following liquid

{% block breadcrumbs %}

{% include 'Breadcrumbs' %}

{% endblock %}

For adding the title to the page, add the following liquid

{% block title %}

{% include 'Page Header' %}

{% endblock %}

For adding side navigation, add the following liquid

{% block aside %}

{%include "side_navigation_portal" %}

{% endblock %}

The main form will be in the Main Block

<div class="col-sm-8 col-lg-8 left-column">

{% block main %}

{% endblock %}

Now the below code is the magic behind meeting the requirement:

Use FetchXML to check if there are any active cases related to the contact:

{% fetchxml my_query %}

<fetch version="1.0" output-format="xml-platform" mapping="logical"returntotalrecordcount="true" distinct="false">

<entity name="incident">

<attribute name="name" />

<attribute name="status" />

<attribute name="createdon" />

<filter type="and">

<condition attribute="parent_contact" operator="eq" value="{{User.Id}}" />

<condition attribute="status" operator="eq" value=0 />




{% endfetchxml %}

  1.  The FetchXML block must be enclosed in the {%fetchxml my_query%} where my_query is holding the result of the query
  2. If you want to check the total records returned by the query, you must use returntotalrecordcount=true otherwise you will always get -1 in count of your records
  3. The total count of result of the query will be accessed by my_query.results.total_record_count

The final piece of code in the page template will be the following

{% if my_query.results.total_record_count > 0 %}

{% entityform name: 'Read only - Profile Entity Form' %}

{% else %}

{% entityform name: 'Editable - Profile Entity Form' %}

{% endif %}

With this simple if/else statement you can control the behavior of the profile page.

Validating Mobile phone

Since we are using Entity Forms to show profile information, we can use Entity Form Metadata to control behavior of fields on the form. To ensure our mobile number is always in xxxx-xxx-xxx format, do the following:

  1. Open Editable - Profile Entity Form
  2. From related records, go to "Entity Form Metadata"
  3. Add a new metadata record with the following properties:
  4. Type: Attribute
  5. Attribute Logical Name:  Mobile Phone (mobilephone)
  6. Find Validation section down the form and add Validation Error Message
  7. Use the ^\d{4}\s\d{3}\s\d{3}$ as regular expression to ensure the mobile phone is in the xxxx-xxx-xxx format
  8. You can tick the "Is Field Required" to make the field required on the screen