Month: August 2017

Dynamics 365 Customer Engagement Portals Source Code

After taking over ADX Portal Microsoft stopped selling it for on-premise version of Dynamics CRM and only licensed Online version of Microsoft Portals. With this move many of the new Dynamics 365/CRM projects which required a portal on top of Dynamics 365/CRM backend had no possible alternative available in market.

Few months back Microsoft announced that there will be a one time drop of source code for Microsoft Portals which would be available for clients/SI looking for a on premise version to use in their projects.

After a long wait yesterday Microsoft released opensource version of Dynamics 365 Portal.

Download Link: 

What is provided in the download:

  • Source code
    • Source code for ADX Studio Framework
    • Source code for Microsoft Portal Framework
    • Source Code for sample portal
  • Dynamics 365 Solutions and Deployer Packages for
    • Community Portal
    • Customer Portal
    • ESS Portal
    • Partner Portal
    • Partner Project Service
    • Partner Field Service
    • Starter Portal
  • Installation Guide


Key points to note are:

  • This is one time source code drop and there won’t be any future releases.
  • There is no support provided by Microsoft for this.
  • If you choose to use this in a project, with any future changes in Dynamics CRM API calls you will have to upgrade it yourself.


Online Management API: Using Console Application

Once you have set up the App Permissions for Azure AD to access Dynamics CRM Online you can use the Application ID to authenticate with Online Management API and work with Various Operations.


Follow the given steps to understand how to set up Console Application to work with Online Management API:

  • Open Visual Studio and Create a new “Console Application”
  • Create a New Class file called “Helper.cs” and copy the helper code (from SDK) to the file.


  • In Helper code update client id to your Application ID while you registered CRM Online App with Azure AD. Set URL to “http://localhost/” 
  • Add Reference to “Microsoft.IdentityModel.Clients.ActiveDirectory”. If you don’t have it installed you can install it through NuGet Package
    • Right click the References -> Click Manage NuGet Packages.
    • Search for “Microsoft.IdentityModel.Clients.ActiveDirectory” and select version “2.x.x” as version “3.x.x” will not work.  Click Install.
  • Replace Program class with following code (taken from SDK Sample) and add missing references.


  • Update the Service URL based on your region.
  • Run the Application, it will ask for Online Authentication and approval to give permissions to app.
  • Once executed you will get instance information.

For Sample Highlighted above you can refer to First Sample solution in following Git Repo.   

Online Management API: Setting up Access through Azure AD

To access Online Management API first thing we need to do is register Dynamics CRM app with Azure AD so that our console application can have access to it.


To register App with Azure AD:

  • Navigate to Azure Portal. (Even if you are using trial account it will work).
  • Go to Azure Active Directory -> “App registration”

  • Click “New Application Registration”

  • Key in the Details


  • Once App is Created you can see app details.  Application ID is the Client ID we require for the app authentication, Keep Application ID with you for authenticating through Client App.

  • To provide this app permission to Dynamics CRM Online Management API click on Required Permissions -> Add -> Select an API


  • Select Dynamics CRM Online from list


  • Once “Dynamics CRM Online” is selected, click “Select Permissions” -> “Access CRM Online Organization users” -> “Select”.



After following above steps you will be able to Authenticate from your custom native app to Online Management API.

Online Management API : Introduction

Microsoft recently released Online Management API for Dynamics 365 Customer Engagement (CRM) instances.

This can be used to automate the process for which we typically required Office 365 Global Admin to Log in to Admin Center and manually slog.

With help of this now we can now go ahead and fulfill our ALM and CI dreams right from setting up a new instance (and going ahead with deploying solutions to those instances using Dynamics CRM metadata calls).


Certain key processes which can be automated through Online Management API are:

  • Creating a new Dynamics 365 Instance
  • Retrieving Instance as well as Information about instances
  • Deleting an Instance
  • Taking a Backup (of instance)
  • Retrieving Backup
  • Restoring Backup
  • Retrieving the Templates i.e. Sales, Customer Service, Field Service etc…
  • Retrieve Currency, Languages supported by Instance.
  • Retrieve operation statuses (which have been Triggered)
  • Update Admin Mode setting of instance so that its not available to users.


Along with above Online management api can also be used to manage server to server authentication by supporting:

  • Creations of Tenant Application Identity
  • Retrieval of Tenant Application Identity
  • Enable or Disable Tenant Application Identity.


Key points to note for API:


In my next blog posts I will cover:

Using Entity List as oData Feed: Dynamics 365 Portal

In Dynamics 365 portals we have “Entity Lists” which can be used to display system view on Portal UI as grids/tables.

Other than above usage entity lists also provide flexibility to expose data as oData web services.

To setup oData scroll down on entity list record to “OData Feed” tab and enter the values of entity type name, entity set name and View.

Based on above configuration system will generate oData URL as https://<portalurl>/_odata/entity_set_name

To fetch the data from above oData service

  • Generate the oData URL.
  • Call oData service and get response.
  • Loop through the response to get the data.



In above code we are passing the account guid to oData as filter and getting list of active contacts tagged to that accounr.

oData service from entity list provide us with various query options like :

  • $filter –> to filter the results based on condition.
  • $orderby –> to sort the results
  • $top –> to get top n results
  • $skip –> to skip top n results.
  • $inlinecount –> to get count of records in the response.
  • $format –> to define the response type, options can be atom, json, jsonverbose.

You don’t have the appropriate permissions. Dynamics 365 Portal

Post upgrade Dynamics 365 Portal we were getting following error during inserting/updating record from portal. 

“You don’t have the appropriate permissions.”

To fix this go to “Entity Permission” and make sure that all permission records which have “Create” and “Update” permissions checked also also have “Append” and “Append To” permission checked.


Refer to Microsoft support block highlighting this issue.

Renaming Attributes on Entity Form: Dynamics 365 Portal

While working on Microsoft Dynamics 365 Portal one of the requirement we had was to rename certain fields on Portal so that those are more self explanatory to portal users.


To do that for entity form,

  • Go to Entity form Record.
  • Scroll down to “Entity Form Metadata” sub-grid.
Dynamics 365 Entity Form
  • Create a new entity form metadata record of type Attribute and Select the Attribute.
  • Update Label field to display the relevant label on the form.
Dynamics 365 Attribute Metadata


To update label in entity list,

  • Go to entity list record,
  • Scroll down to “Options” tab and “Grid Configuration” section.
  • In “Override Column Attributes” select “Attribute”, key in “Display Name”, put column width in pixel (percentage was not working for me).
Dynamics 365 entity list

Using Dynamics 365/CRM App Designer (Part 2 of 2)

In previous post we created a basic app and saw how we can control different components within an app.

In this post we will see how to restrict the access to specific app based on user role.

For this:

1.  Go to Settings –> Application –> My Apps

Somehow “My Apps” is not available under CRM default app/sitemap but it is available under others like Sales and Customer Service App.


In case you don’t have it you can navigate to it by path “”

Replace inastancename.crm with your org and region specific path.


2. On all apps (other than default) you can select “Manage Role” under settings and select that app should be visible for which security role.





NOTE: You can’t remove access from “System Administrator” and “System Customizer”


3. In case you want to hide default app of dynamics CRM then

Go to Settings –> Administration –> System Settings

Under General Tab “Set option for Default App: to No.



With above settings relevant apps can be displayed to users and all non relevant apps can be hidden from UI.

Using Dynamics 365/CRM App Designer (Part 1 of 2)

One of the newer features of Dynamics CRM is introduction of App Designer. This feature is replacing old concept of Site Maps in Dynamics CRM. With this feature we can rely on easy to use interface from product itself to select which entities will be visible in top navigation to users.

So no more relying on xml editing or third party tools.

What is an App in Dynamics 365 ?

When you launch Dynamics 365, on left hand side you can click small Arrow to see list of Apps. These can be third party apps (if you have installed those) or product apps specific to business functions.

You can also define your own apps here.



How do I create an App which is specific to my Business Requirements ?

Steps are simple:

1. Go to Settings –> Solutions –> Either Create a New Solution or open existing project specific solution.

There will be a section for Apps at bottom of left navigation.



2. Click App –> New and App designer window will appear.

You can provide properties like App Name (Visible in Home page App navigation) and URL Suffix ( Easy to remember path)

3. Once you have created app, Click Arrow near “Site Map”



4. Click on Area, Give it a Valid name,  Group, Sub Group and So on.

You can click add button on top to add more areas, group etc…  or Right Component Section to Drag areas, groups etc…


5. On Save and Close of Site Map editor, you will see the entities you have selected are available in your entity View.

Deciphering the main App Areas.

Site Map : To design top navigation of Dynamics CRM interface.

Dashboard/Business Process Flows: To select dashboards and business process flows available within this app.

Entity View: This will dynamically include entities based on your sitemap, dashboards and business process flows. Here you can select which forms, views and charts that are visible in given app.



For demo I will keep it simple and select two views (Active and Inactive Accounts/Contacts), validate and Publish the App.


Result Post Update

Default Site Map:



Updated Site Map





Default List of Views:



List of Views in App  (Only Active and Inactive)



Above steps helped us in creating a new app for our organization and restricted System Views .

Note that system views will not be restricted in Advanced Find.

In Next post I will highlight how to restrict access to apps based on security roles.

Hiding System Views

While working on Dynamics CRM one of the most irritating issue is that System Views are Global and there is no (direct?) way through which you can control them based on User/Security Role/ BU etc…

Till now I have come across 3 different ways you can restrict system views visible to users and you can select which method to use for your need:

1. Using Security role based Views:
This is not an official way of controlling system views but its more or less supported.
For this method there is a tool (which used to be free) called Role Based Views by CRM MVP Debajit Dutta.
You can download free version at codeplex which is available for 2011 and 2013.
For 2015 onwards you can purchase it at XRMForYou.

In principal how this tool works is.
It has plugin written on Retrieve Multiple (of savedquery) and based on configuration you do in the tool, it intercepts the retrieve multiple, checks user security role and decides whether to let user see the view or not.

2. If requirement is not role based and its to hide certain views which were created specifically for Sub-grids.
In few cases we create some system views to display on form sub-grid only, if you want to hide those views in Home screen then simple workaround it “DEACTIVATE” those views.
You will still be able to use those on sub-grid and those will not be visible on home screen and dashboards.
Thanks to OldCat65 for this.

3. You need role based view but don’t want to pay for it.
Option 1: Write your own.
Option 2: Use Apps in Dynamics 365.
Using “Apps” in Dynamics 365 you can create your own site map navigation and define which entities, forms and views are part of app. On the home screen of the App only the views selected within app will be visible.
Bonus, Apps can be restricted based Security Roles.