Contact Management from Dynamics 365 Portal – Part 2


  • The Portal Contact form was being used by Admin for managing contacts to Create, Edit & Deactivate from Portal.
  • When new Portal contacts were created from the portal, Duplicate records were getting created despite the Duplicate Detection rule on Dynamics. It, however, showed a system message which was not understandable.
  • If the new user to be created was an Inactive user, he needed to be activated rather than be created.


  • Liquid code could not be used since it could not be triggered on change event of the email address field.
  • Defining a custom solution which worked in parallel with existing features.


  • To detect and restrict duplicate contacts getting created from the portal and provide an appropriate message there.
  • If contact is “Inactive” in CRM, rather than create a new contact, the same should be activated.


Since the duplicate detection Rule on dynamics could not be extended to the Portal, a custom process to be created using JavaScript and Liquid code  –

  • JavaScript to trigger the event of the Create Page
  • Liquid to query data on another Page.
  1. The Redirect web template:
    • Go to Portals ➤ Web Templates and Create Web Template “My Custom Web Template”, paste the below code in source property

      {% fetchxml contacts %}

      <fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false” count=”1″ returntotalrecordcount=”true” page=”1″ >

           <entity name=”contact”>

           <attribute name=”contactid” />

           <attribute name=”statuscode” />

          <filter type=”and”>

             <condition attribute=”emailaddress1″ value=”{{request.params[’emailId’]}}” operator=”eq”/>     




      {% endfetchxml %}{  

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

        “value”: [{  

            “contactid”: “{{contacts.results.entities[0].contactid}}”,

            “statuscode”: “{{contacts.results.entities[0].statuscode.label}}”}      


         {% else %}

         “value”: []

         {% endif %}


  1. Its Page template

    Go to Portals ➤ Page Templates and create page template named “My Custom page template”, Website->Select your website, Type ➤ Web Template, Web Template ➤ “My Custom Web Template”, Entity Name ➤ Web Page(adx_webpage). Click Save.
  2. Its Web page so that it can be accessed.

Go to Portals->Web Pages and create web page give any name “My Custom Web Page”, Website ➤Your website, Parent Page->Home, Partial URL ➤”any name of your choice”, Page Template➤ “My Custom page template”, Publishing State->Published and click Save.

  1. On the Create Contact page – add the below JavaScript to trigger on the change event of the Email ID Text field.

Go to Portal ➤ Web Pages->Open your page and click on a web template and paste the below code in source property of web template and click Save.

Note: If you are using default web template then create a new one

  <script type=”text/javascript”>   

      $(document).ready(function () {  

   $(“#emailaddress1”).change(function() {


      var httpReq = CreateHTTPRequest(“GET”, “/mycustomwebpage/?emailId=” + $(“#emailaddress1”).val(), false);


        if (httpReq.status == 200) {

      var contactId = JSON.parse(httpReq.responseText).value;

            if(contactId.length > 0)


                if(contactId[0].statuscode == “Inactive”)


                   $(‘.breadcrumb’).append(‘<div class=”notifications” style=”display: block;”> <div class=”notification alert alert-danger error alert-dismissible” role=”alert”><button type=”button” class=”close” data-dismiss=”alert” aria-label=”Close”><span aria-hidden=”true”>×</span></button><span class=”fa fa-exclamation-triangle” aria-hidden=”true”></span> Note: This contact already exists in CRM, in InActive mode. Click <a href=”/updatecontact?id=’+ contactId[0].contactid +'” target=”_blank”>here</a> to open the record and Activate.</div></div>’); 




                   $(‘.breadcrumb’).append(‘<div class=”notifications” style=”display: block;”> <div class=”notification alert alert-danger error alert-dismissible” role=”alert”><button type=”button” class=”close” data-dismiss=”alert” aria-label=”Close”><span aria-hidden=”true”>×</span></button><span class=”fa fa-exclamation-triangle” aria-hidden=”true”></span> Note: This contact is already exists in CRM</div></div>’); 




            else{ $(‘#InsertButton’).attr(‘disabled’,false); }       




      CreateHTTPRequest = function (action, url, async) {

    try {

        var httpReq = new XMLHttpRequest();, url, async);

        httpReq.setRequestHeader(“Accept”, “application/json”);

        httpReq.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);


    catch (ex) {

        throw ex;


    return httpReq;



Note: In the above script change the click here to open and the activate link to your edit contact page. Steps to create Edit contact page below.

  • Create Edit contact page to activate contact on portal
  • Create a new web Contact form in CRM. Fields
    • Full Name
    • Account
    • Work Email address
    • Contact details
  • The update contact form on Portal
    • Go to Portals ➤ Entity Forms ➤ New and Create new entity form for update Contact. Select Entity name ➤ Contact, Form Name as created above in Dynamics, Select mode as Edit, Record Source type ➤ Query String, Record ID Query String Parameter  ➤ id. Website ➤ Select your website.
    • In Additional setting ➤ Action Button Configuration ➤ Actions ➤ Click on +Activate
    • Go to Portals ➤Web Pages ➤ New and Create a web page for update contact entity form.

You can add some emails and templates to be triggered on any changes to be tracked!

Also, check out Contact Management from Dynamics 365 Portal – Part 1

Contact Management from Dynamics 365 Portal – Part 1


  • The Customer service Portal using Azure AD authentication was being used by the client to collaborate on products changelogs, consumption changes, Invoices, project documents and updates, customer service tickets and Company information management
  • Customers have multiple users belonging to different departments who need to access the portal and review and update information in different capacities.
  • Every time a new client stakeholder needs to be given access/ removed to the portal, the CRM admin team needed to action it.
  • The onus of security of critical client information management was entirely on the CRM team.


  • Transfer onus of security:
    • CRM Admin to create one portal user from the customer Contacts who would have permission to create, update and deactivate other contacts from his organization – the client “portal user manager”
  • Managing users:
    • He should be able to assign the required Roles and even create other Portal user managers.
    • He should be able to deactivate these users and also update their portal role if needed. However, they should not be deleted from CRM.
  • User Access:
    • Users should be sent an invitation to be redeemed via email when they are created.


  • Go to Portals ➤Web Roles and create web roles
    • Portal user manager
    • Portal Finance User
    • Portal IT User
    • Portal Project user
  • Create a two-options field for each Web role above on the Contact entity
  • Create a new web Contact form in CRM. Fields
    • Full Name
    • Account
    • Work Email address
    • Contact details
    • Web role two-options [for as many roles defined]
      • Go to field properties ➤ Formatting ➤ Control Formatting ➤ Select Checkbox
    • Is Portal contact
  • Create a copy of the above form for the update contact process
  • Create a view in CRM – “Show Portal Contacts
    • Add filter Status Reason=Active and Is Portal Contact=Yes
  • New Portal Contact page
    • Go to Portals ➤ Entity Forms ➤ New and Create new entity form for new Contact. Select mode as Insert.
      • Add the below script to set the ‘Is Portal contact ‘ to true and hidden

$(document).ready(function() {

$(‘#iotap_isportalcontact’).prop(‘checked’, true);




  • Go to Portals ➤ Web Pages ➤ New and Create web page for new contact entity form.
  • Update Portal Contact page
    • Go to Portals ➤ Entity Forms ➤ New and Create new entity form for update Contact. Select mode as Edit.
    • Go to Portals ➤ Web Pages ➤ New and Create a web page for update contact entity form.
  • The default “Invitation” entity and the workflow “send Invitation” will be used

Create an on-demand workflow on Contact entity to trigger when “Record is created” to associate web role and send a portal invitation when a new contact is created from the portal.

record is created

  • Manage Users page
  • Go to Portals ➤ Entity Lists ➤ New and enter Name, Entity Name-Contact(contact), Website-your website, click +view button select view “Show Contacts Portal” and then again select +view button and select “Active Contacts
  • Grid Configuration ➤ Item Actions ➤ +Edit and set Target Type as Entity Form, Entity Form- “Update Contact” and Button Label as “Edit
  • Grid Configuration ➤ Item Actions ➤ +Deactivate and set Button Label as “Deactivate
  • Go to Portals ➤ Web Pages ➤ New and create a web page for “Manage users” entity list
  • Create a navigation Link – “Manage users” which is accessible only to the Portal user manager role
    • Go to Portals ➤ Web Link Sets ➤ Primary Navigation ➤ Links ➤ Add New Web Link with Name, Publishing state as Published, Parent WebLink as Home, Page as “Manage users”.
    • Go to Portals ➤ Web Page Access Control Rules ➤ New and create Access rule with Name, Right as “Restrict Read”, select “Web Page” and select “Web Role” “Portal user Manager”.
  • Create a duplicate detection rule [if not available] based on the contact email Id, so that duplicate contacts are not created by the user manager.
    • Go to Settings ➤ Data Management ➤ Duplicate Detection Rules ➤ NewNew Rules
    • Publish.
  • New button
    • Go to Portals ➤ Entity List->Select entity list “Manage users” set Web Page for create and Create Button Label as “New

The completed customization

completed customization

Also, check out Contact Management from Dynamics 365 Portal – Part 2

Dynamics 365 Portal Authentication – Options and Features

Dynamics 365 Portals provide multiple authentication mechanisms and features which are very easy to configure. Having said that, rather than allow all modes [which may ultimately result in clutter and confusion] answers to a quick survey of the below questions should be collated when finalizing them.

  1. Who are the Potential portal users – Internal employees and Partners who are available as dynamics contacts or prospects and customers who are external?
  2. Which mechanism would make it easier for them to login?
  3. Do you have the required manpower and systems to manage any requests/ issues which may be reported?
  4. What is the information/ collaboration expected on the Portal?

While authentication is the gateway for a user to access the portal, the below 2 configurations are equally important to be set up for user access.

Basic set up for a Portal User

  1. Contact set up: In a portal application, an authenticated portal user is associated with either a Dynamics 365 Contact or System User. The default portals configuration is contact-based. The contact can be created
  2. Web Role: Portal users must be assigned to a web role to gain permissions beyond unauthenticated users.


Portal users can sign in ether with authentication provided by Dynamics 365 contact membership provider or with an external account based on ASP.NET Identity.

Local authentication: Local authentication is the common forms-based authentication uses the contact records of a Dynamics 365 for Customer Engagement organization for authentication.

External authentication: External authentication is provided by the ASP.NET Identity API. In this case, account credentials and password management are handled by a third-party identity provider. This includes OpenID based providers such as Yahoo! and Google and OAuth 2.0 based providers such as Twitter, Facebook, and Microsoft. Users sign up to the portal by selecting an external identity to register with the portal. After it is registered, an external identity has access to the same features as a local account.

Options available

  1. Windows Authentication
  2. Windows Live ID Web Authentication
  3. Form Authentication
    • External (social provider) user sign-in through third-party identity providers
    • Open registration

The Portal login screens

Sign in by using a local identity or external identity

auto account setup

Sign up by using a local identity or external identity

register for new account

Redeem an invitation code manually



  1. Email address confirmation
    1. Authenticated users manage their user accounts through the Security navigation bar of the profile page. The profile page is also where the user is reminded to confirm their email address by requesting a confirmation email to be sent to their email account.
  2. Password recovery and Password reset
    1. Returning visitors who require a password reset (and have previously specified an email address on their user profile) can request a password reset token to be sent to their email account
  3. Redeem invitation
    1. Both local and external account registration can use invitation codes for sign up, as well as the email confirmation workflow. These invitations can be generated and sent out from Dynamics by permission users by email
    2. Redeeming an invitation code allows a registering visitor to be associated with an existing contact record that was prepared in advance specifically for that visitor.
    3. With open registration enabled, however, users are not required to provide an invitation code to complete the sign-up process.
  4. Two-factor authentication with email
    1. The two-factor authentication feature increases user account security by requiring proof of ownership of a confirmed email in addition to the standard local or external account sign-in.
    2. A user trying to sign in to an account that has two-factor authentication enabled is sent a security code to the confirmed email associated with their account. The security code must be submitted to complete the sign-in process
  5. User Lockout
    1. When a certain number of failed password attempts are detected in a short period of time, the user account is locked for a period of time. The user can try again after the lockout period elapses

Meanwhile, another interesting related information about the portal which supersedes authentication is that while the Dynamics 365 for Customer Engagement Portal is public when provisioned and accessible by anyone from any computer, now you can restrict access to your portal from a list of IP addresses.

For example, a government organization might want to surface their content only within their corporate network. A commercial organization might want to display the portal only when it is published and not while it is in development to avoid any data leak.

When a request to the portal is generated from any user, their IP address is evaluated against the allow list. If the IP address is not on the list, the portal displays a web page with an HTTP 403 status code!

Use Cases for Dynamics 365 Portals

Microsoft made a strategic move with the transition to the Dynamics 365 product by dividing the previous modules into standalone apps – Customer Engagement henceforth referred to as CE Apps 

Organizations, whether we are using one or even all the apps on CE, are constantly engaging with the customer, building the data in the App or sharing the output from it.

use cases dynamics 365

Documents and data for Customers go through different organizations from Marketing to Billing. Sales department create quotes, Accounts and Finance create and share Invoicing details or Customer Service Desk share statuses on Cases resolutions, and Project teams share Plans, Tasks, Milestone updates.  

All this Process Redundancy, Email Clutter and Dual Data Entry can be streamlined by sharing data directly with the end customers through the Microsoft CRM – Dynamics 365 Portal for the Customer Engagement and Custom applications.

The Dynamics 365 Portal is the tool to surface specific entities and records from within the Customer Engagement apps to enable processes with external collaborators and stakeholders like your customers and partners. 

On the Dynamics 365 Portal, the Organization can define the audience it wants to invite, define the data it wants to be exposed, define the Role of the User logging in and define the entire User Experience.

Also, read – Top 10 Reasons to Invest in a Dynamics 365 Portal 

Dynamics 365 Portals Use Cases

Customer service

Customer Service departments receive inbound calls and emails every day to request help. These interactions can often result in cases, incidents or trouble tickets that need to be resolved for the customer. In case of Organizations using CE Apps when cases are surfaced via a portal, users can create, update, add attachments or even comment on cases themselves, bypassing the need to Search/Speak directly with people in the organization, just use the inherent routing rules.

Exposing Knowledgebase articles helps deflect a lot of repetitive cases and prompts customers towards SelfServicing.  The Analytics on time spent, Entitlements remaining and consumed, Service related invoices are data points which can be made available on the Portal. An added dimension of Live Chat can be added for a more focused service.

Finance and Accounts

Invoicing is another common usecase for customers with Recurring or consumption-based billing. Work 365’s recurring invoices are automatically made available for customers to view and download from the self-service portal. Enabling integration to an ECommerce portal and a Payment Gateway can make the experience 360 degrees complete for the Customer.

Sales and Marketing

Partners and Sales Consultants can access Marketing collateralflyers, decks, etc. from CE Apps using secure access to the Portal 

They can add/ update the Accounts, Leads, Opportunities* and Contacts using the welldefined Dynamic Role Matrix. Working directly on the same CE application, the Sales Pipeline is always updated and information, correct. 

The Marketing department and New product team can use the Portal Dashboard to announce upcoming events and Product Launches to the Customer/ Partners. Customer can request new Products and services and schedule meetings with the Account Manager. 


Teams can Collaborate on projects not only for sharing Proposals, Kickoff decks, Scope documents, etc., but also to get approval on Time Spent, discuss and escalate Risks, surface Upcoming Tasks and share Invoices from the Portal 

As a closing note – The key to any successful engagement is delivering the right information to the right users at the right time. Since Portals are device agnostic, Organization business operations can extend from the back (and front) office to the smartphones, tablets, and desktops of customers always available and always on!


Top 10 Reasons to Invest in a Dynamics 365 Portal

While each Organization must find its own trigger, I’ve laid out some common underlying set of reasons which resonate across Organizations 

1) Productivity

  • Repeated and redundant Tasks of creating, updating and maintaining data, especially when it is worked on by multiple groups within and outside the organization is done away with.  
  • Setting notifications and alerts on relevant Portal activity, ensures users are informed of updates pertaining to their concerned areas. 
  • Effective use of Dashboards can showcase synopsis of updated information 
  • Allowing external users to create, update and view requisite information – data and documents, using inbuilt application validations and security, saves the Organization time and effort consumed to update it on the System from the shared location

2) Cost-effective 

  • Did you know that you have a free portal? Every Organization who has 10 Enterprise licenses has a Portal which can be used for Collaboration and Service 
  • Its hosted for free on the Microsoft cloud – which means that there is no monthly hosting charge 
  • It comes with an inbuilt SSL certificate and a domain name– so no hassle of any purchase or renewal there too 
  • The only cost is what it takes to build and configure it. Provided that the required skillsets on Html, JavaScript, and Liquid are available, adding pages and content are completely do-able tasks

3) Inherent Integration

  • The Portal has seamless Integration with all CRM objects and entities. No external tools or services are needed for the communication
  • Real-time data updates and transfers make it an extended arm of the core CRM application.  

4) Secure sharing 

  • Multiple authenticating options – LinkedIn, Facebook, Azure AD, etc. are available along with the ability to implement Single Sign-on with O365 enable sharing data from secure CRM   
  • Being equipped with SSL, data transfer over the web transfer over an Encrypted pipe which is backed up with Microsoft certifications  

5) Real-time 

  • While the Organization can easily only surface specific data which it wants to from within CRM, real-time updates make it seem like working on the same database with 2 front ends  

6) Choice of interaction 

  • The portal allows Organizations to provide an alternative mode of communication to its Customers, Employees and Partners. Take an example of a Customer Service department being able to service not merely through Email, Chat and Phone, but now through the web too.
  • Time can be booked for Field Service Visits and PreSales meetings from within the Portal itself and directly integrate with the CRM Resource Board and Target achievements, making it a great choice or Self- servicing 

7) Transparency 

  • Being real-time, Sales and Customer Service Organizations are benefitted. Be it the closure of Opportunities or meeting and beating SLAs, everything can be easily recorded and shared transparently. 

8) Always on 

  • Portals come in build with the Microsoft assurance of being 99.99% on. 

9) Marketing, Analytics, and Insights 

  • Quickly link your Portal web pages to Google Analytics to understand adoption and effectiveness.  
  • Link to the Portal from your corporate website for users to Login to create a seamless experience of viewing secure information pertaining to their engagement only 
  • Display Events and Announcements on your Portal to inform your niche audience about the most important happenings, achievements, and Offers 
  • Understand if your Portal draws an audience to your knowledge base, your Shared Invoices, Project Status/ timesheets, or available field service schedules.

10) Choose your Audience and Content 

  • Send invitations to your niche clients and partners and let them view and add to your data store. You can roll out the portal in phases and expose data as its ready. 
  • Grant roles in CRM to your Portal Users and allow them to access only to specifically surfaced data

If you are an organization using Dynamics 365, and you have identified that the time is right to invest in a Dynamics 365 portal *– do it now. Your free to use Portal is lying wasted!

*Check the blogIntroduction to the Dynamics 365 portal 

**check the blog The right time to invest in the dynamics portal

When is the Right Time for Businesses to Invest in a Dynamics 365 Portal?

Where there are other financial* and IT** considerations which may impact the decision, there are 2 main situations which can be used to identify if the Organization is ready for/ needs a Portal.  

 1) When Dynamics data/ documents need to be regularly be viewed/ shared with external users – customers or partners.  

Client and partner engagements at every step need the information to be exchanged in the form of data and documents. Sharing these over emails or shared locations very often results in duplication and redundancy. Furthermore, the team is losing productive time maintaining this update. 

Sharing controlled data right from its source in Dynamics to secure external Roles can easily remedy the situation. 

Activities to look out for when identifying that the Organization should surface information via Portals 

  • When you see that the CRM users are frequently having to share reports, request data, send alerts, expose status’, etc.,
  • Where you want to ensure that the external user always has the most updated information residing in Dynamics
  • Provide access to KBs, Blogs and access Discussion forums, ensuring that the partner/ customer is engaged and enabled

2) When external users need to create or update data/ documents which are maintained by the Organization in Dynamics 

While any license impact based on the user and the kind of activity performed must be clearly understood and adhered to before investing in the portal, the Portal is a great tool to allow Partners and customers restricted and secure access to add/ update specific sections of the Organization Dynamics 365 apps. 

Some simple use cases where Dynamics may need such updates – 

  1. When Partners, Distributors and sales channels need to share new/update their sales opportunities 
  2. When Appointments need to be booked 
  3. Cases – create and updates 
  4. Moderated Discussion Channels re needed Questions and Common Update and need to be,  
  5. update time and expenses on Projects. 

Some thoughts on the “How”

The Dynamics Organization can provide a seamless experience to external users,  by linking it from its corporate site, replicating the branding and using Azure AD authentication. Roles defined can showcase targeted content to different roles within the same client organization.  Keeping the Portal content and forms simple but relevant will help in increasing footfalls on the portal. 

While the Internal users need to be cognizant of their actions on Dynamics and the fact that some of it will be visible to the customer, per se, the Portal need not have all the data saved and managed on Dynamics surfaced.

* while 1 instance of the CRM portal is available for free to all Dynamics 365 Organizations, provided they fit in [ check the previous blog “Dynamics 365 Portal – Introduction”], any UAT and Test environments have a cost attached 

** Portal development needs some development skills on HTML, JavaScript and “Liquid” apart from having a good handle on Administration of Administration and Security on Dynamics. The Portal developer will need System Customizer, Portal Admin and in some cases, Global Admin credentials on Dynamics. 

Dynamics 365 Portal – A Quick Introduction Before Our Journey

The Background 

The Microsoft Dynamics 365 Portal was formerly known as ADX Studio Portal. The Canada-based Adxstudio team had been building web portals for customer relationship management software since 1998. 

Back then, it was an web site which surfaced the Organization Dynamics CRM data – online or On-premise. It could be hosted on any server and could be completely Customized, Branded and Integrated. 

Microsoft Acquisition 

Adxstudio was acquired by Microsoft in 2015. In its GA release in Spring 2016 from Microsoft, the Portal was available as a fully Microsoft – managed Dynamics 365 add-on only. Until August 2018, Microsoft continued supporting the legacy ADX Studio Portal product, however, since then, all formal support for the old product has been discontinued. 

Dynamics 365 Portal– today 

The product, Dynamics 365 Portal, in its new form has its on-premise footprint completely wiped out – it is now available to only the Dynamics 365 instances in the cloud. [Recently, Microsoft has released source code to create a framework for on-premise portal deployments – albeit this isn’t officially supported ] While an organization can host multiple portals drawing data from its Dynamics 365 instance – the relation is strictly N:1 – Portals could now access CRM data only in the same Office 365 tenant.  

Implementing customizations via Server-side codes is no longer possible. JavaScript and “Liquid” have become the chosen tools to extend this Microsoft product. Originally released in its 8.1 version, the product is today available as 9.1.5 

License, in brief 


Organization employees and partners, depending on their CRM activities from the portal need the correct license – Full or Team. 

  • Organization: 

Effective October 2018, every Organization with 10 Dynamics 365 Enterprise subscriptions has one Portal already available for use. Any additional portal instance required is available at a cost – including any Sandbox or Test tenants 

  • Multiplexing: [Indirect] 

Internal users and devices accessing Dynamics 365 data indirectly through a portal or via an API to a separate service such Microsoft Outlook must be properly licensed 

Capacity in a nutshell 

  • Page Views: The Portal includes 1 million-page view 
  • Common Data Service Database: 10GB
  • Common Data Service File Capacity: 5MB- 32 MB/ file
  • Common Data Service Log Capacity: 2 GB 

Audience and Portal Types 

While each of the portal types can be configured to cater to multiple audience groups, pre-configured Portal templates are available for Partners, Customers and Employees separately [ Employees will require proper CRM licenses to access Portals data] 


  • Customer Self Service Portal
  • Custom Portal
  • Partner Portal
  • Partner Project Service (Optional, requires solutions installed)
  • Partner Field Service (Optional, requires solutions installed)
  • Community Portal 


  • Customer Self Service Portal 
  • Custom Portal 
  • Community Portal 


  • Employee Self Service Portal 


Available authentication types 

  • Forms Authentication 
  • Windows Authentication
  • Windows Live ID Authentication
  • Windows Azure Authentication 


Roles for the Portal User are defined within Dynamics 365. Permissions and data access use the same processes as used for CRM user roles. 


While there is enough to write pages on each of the items in the bullet above, hopefully, the above data points and references have given you an overall premise of Dynamics 365 portals, scattered in various documents and blogs in a nutshell.

Coming up 

With this background, we will in the next blog, in this series, delve into the When and Why of the Dynamics 365 Portals. 

What is the right time to invest in Dynamics 365 Portals and some strong Pros and Cons to help you decide