Archive for the ‘Dynamics 365’ Category

D365 July Updates – Multi select option set and Virtual entity

September 10, 2017 Leave a comment

With July updates Dynamics 365 introduced few new features. I am going to touch base:

Virtual Entity:

  • Virtual entities replace previous client-side and server-side approaches to integrating external data, which required customized code and suffered from numerous limitations, including imperfect integration, data duplication, or extensive commitment of development resources.
  • Virtual entities are stored in CRM with an internal metadata flag on the entity marked as virtual, which tells the system not to put a schema in the database. Virtual entities are organization owned, there isn’t any CRM role level security for virtual entities. Each virtual entity points to a row from the data source
  • Refer this Article

Multi-select option set:

  • This is long awaiting feature. Limitation of existing Option set was we could select only one option. With the advent of new control we can select multiple options.
  • Select options stored in a field separated by ;
  • Features of the new Multi-Select option set include:
    • A new AttributeType: MultiSelect Option Set introduced.
    • We can add control to forms, views, and quick create forms, and read-only and editable grids
    • Can add up to 150 values available for selection
    • ‘Select All’ and ‘Clear selection’ feature
    • Supported in Advanced Find and FetchXML queries
  • Refer for more details.




(Step By Step) Surface Power BI Reports in Dynamics CRM Dashboard

In this article, I am going to provide ‘Step-by-Step’ details on how to:

  • Add ‘Power BI’ subscription to your existing Office 365
  • Connect to your ‘Dynamics CRM Organization’ from BI
  • Render Power BI reports in CRM Dashboard.

What’s Power BI and How is it different from SSRS?

  • Power BI offers basic data wrangling capabilities like Excel’s Power Query.
  • It also lets you create interactive visualizations, reports and dashboards with a few clicks and handle files that are too large for Excel.
  • On the other hand, SSRS is meant for “static” reports. Something that will be shown always as defined and printable.

Steps to add ‘Power BI’ subscription:

  • As a pre-requisite, create your 30 days Dynamics 365 free trail.
  • Login to ‘’ and open ‘Admin’ dashboard
  • Go to ‘Billing -> Purchase services -> Power BI (free) -> Buy now
    • Note: This requires you to provide credit card details and INR 2 will be charged after successful purchase.

D365 - Power BI

  • After successful purchase, open ‘’ on another tab of the browser and click ‘Sign In’

D365 - Power BI - Start

  • Click ‘Start’

Connect to Dynamics CRM organization from Power BI:

  • To connect to CRM Organization from ‘Power BI’, you need to install one of the ‘Content Packs’

D365 - Power BI - Content Packs

  • Click on ‘Get’ button from ‘My organization’ section
  • From the available list, choose any of the Dynamics CRM related Apps (I chosen ‘MS Dynamics Online Sales Manager’ for this demo, from the ‘Apps’ tab)

D365 - Power BI - CRM Sales Manager Pack


  • Click on ‘Get it now’ and you will be asked to provide CRM credentials.
    • Provide ‘CRM Organization URL’ details and ‘Last Month Of the Fiscal’

D365 - Power BI - Connect To CRM

    • Choose ‘Authentication Method’ as ‘OAuth2’

D365 - Power BI - Connect To CRM - OAuth

  • Post successful login, you would see ‘Importing Data’ message

D365 - Power BI - Connected To CRM - Importing Data

  • Give it few seconds and you would see beautifully rendered reports

D365 - Power BI - Connected To CRM - Dashboards.PNG

Display ‘Power BI’ reports in CRM Dashboard:

In previous versions of CRM, only option to bring ‘Power BI’ reports are by placing an IFrame in Dashboard and set the PowerBI URL. Its easily configurable now.

  • Connect to your Dynamics CRM Organization
  • Go to ‘Settings -> Administration -> System Settings -> Reporting -> ‘Allow Power BI….’=Yes

D365 - Enable embed Power BI

  • Create a new Dashboard
  • Select the placeholder and from the Report add options, click ‘Power BI Tile’

D365 - New Dashboard - Add Power BI Tile

  • Pick one of the available ‘Power BI Reports’

D365 - Add Power BI Tile - Pick Dashboard

  • Save the Dashboard
  • Go to ‘Sales -> Dashboard’ and pick the created ‘Dashboard’

D365 - Open Dashboard in D365


Dynamics 365 – Error while sending mail on behalf of another user

Recently one of my users complained that they could not send mails on behalf of another users.

Unable to send email on behalf of another user

Issue was because of missing privilege and a setting at actual user, whom the other user trying to send on behalf of

Reason and fix:

To explain this better, I have 2 Users in my system

  • ‘Aruna’ : Having ‘Salesperson’ security role
  • ‘Rajeev’: Having ‘System Administrator’ security role

Issue coming up when ‘Aruna’ trying to send email as ‘Rajeev’ (i.e., Email.From=’Rajeev’)

To allow ‘Aruna’ send email as ‘Rajeev’ below 2 conditions has to be met

  • Provide ‘Send Email as Another User’ privilege to Aruna’s ‘Salesperson’ Security Role

Security Role - Send email as another user

  • Actual User (i.e., Rajeev) should enable ‘Select whether users can send email for you‘ option in his Personal Settings.

Personal Options - Other users can send email


Dynamics 365 – Native Sitemap Editor

Before Dynamics 365, to edit the Sitemap we had to rely on 3rd party solution like ‘XRM Tool Box’ Site Map Editor, Visual Sitemap Editor.

With advent of Dynamics 365, a native ‘Sitemap Designer’ has been shipped with product and its very simple to use.

To edit the sitemap

  • Open ‘Default Solution -> Client Extensions’
  • You would get all the available Sitemaps listed (If you subscribed to Field Service, Project Service etc, you would see additional sitemaps)
  • For this article, I am going to edit the default ‘Site Map’, so double click on ‘Site Map’
  • It would open ‘Sitemap Designer’
  • To rearrange the ‘Sub Areas’ (i.e., Entity/Component icons) you just need to drag and drop

D365 - Sitemap Editor

Add new Sub Area to Sitemap:

Let me add an Icon (i.e., Sub Area) to open ‘Dashboards’ with default as the ‘Customer Service Operation Dashboard’ under ‘Customers’ group

  • Select the ‘Customers’ group and from the ‘Components’ tab, drag and drop ‘Sub Area’
  • Set the ‘Type’ as ‘Dashboard’, ‘Default Dashboard’ as ‘Customer Service Operation Dashboard’ and Title

Sitemap Editor - Add Dashboard

  • Save and Publish.

Hide/Show Sub Area using ‘Privileges’:

Sometimes we get a requirement to show/hide Sitemap icons based on User’s Security Role.

  • Select the Sub Area
  • Expand the ‘Advanced -> Privileges -> Entity’
  • Choose the entity (i.e., I set the Entity as ‘Site map permission’ which is a custom entity)

Sitemap Editor - Sub Area Privileges

  • Only users having ‘Security Role’ with Read privilege on the ‘Site map permission’ entity can see the icon

We can also set localization labels, Clients (i.e., Web or Outlook or Mobile) where the Sub Area should be available to.


Categories: CRM, Dynamics 365 Tags:

New field ‘Sort Date’ in Activity Pointer entity – Dynamics 365

January 26, 2017 Leave a comment

A new field ‘Sort Date’ (Schema Name – sortdate) has been added to the ‘Activity Pointer’ entity to control the sorting of the Activities.


Limitation with earlier CRM versions:

  • To display a list of activities and order them by date, we can only use the common date attributes like ‘Created on’ or ‘Modified on’ defined in the activitypointer entity.
  • What if you have to sort Email activities by ‘Sent On’ attribute rather than the modifiedon attribute value?

How ‘Sort Date’ Solves This:

  • With ‘Sort Date’ attribute, we can control how activities are sorted by desired date.
  • By default, the ‘Sort Date’ attribute value is null.
  • Set the ‘Sort date’ attribute value using a workflow or a plugin with required Date value (For example, set ‘Sort Date’ with ‘Sent On’ value in case of Emails) and use that in views.


Dynamics 365 Mobile Client – Script to get Longitude and Latitude and pin to Maps

January 14, 2017 1 comment

With the new Dynamics 365 Mobile client, we got a new API Xrm.Utility.getCurrentPosition which returns the current location coordinates.

This API only works with Mobile Client and referring this in Web Application would cause script error.


We need to Enable User Location setting on the device

  • Go to Settings -> Device Integration Settings


  • Enable “User Content and Location”


Script to get coordinates:

function onload() {
var isCrmForMobile = (Xrm.Page.context.client.getClient() == “Mobile”);

if (isCrmForMobile) {
(function (location) {
Xrm.Utility.alertDialog(“Latitude: ” + location.coords.latitude +
“, Longitude: ” + location.coords.longitude);
function (error) {



HTML File to Read Coordinates and Show in Map



Code snippet – Connect to Dynamics CRM using Organization Service C#

December 11, 2016 1 comment

Below is the sample code to connect to Dynamics 365/CRM online 2016 using simplified connection.

This sample authenticates the user with the Dynamics 365 web services by using the CrmServiceClient and methods.

Required CRM SDK .Dlls:

  • Download the SDK to get the required .dlls
Required dlls

Required dlls

Required Namespaces :

using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Tooling.Connector;

Configure connection string in App.Config:

O365 Connection strings

O365 Connection strings

C# Code:

String connectionString = GetServiceConfiguration();
CrmServiceClient conn = new CrmServiceClient(connectionString);

// Uncomment below statement in case you want to use Organization Service
// IOrganizationService orgService = conn.OrganizationWebProxyClient != null ? conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

OrganizationServiceProxy orgService = conn.OrganizationServiceProxy;

// To impersonate, set the caller GUID
orgService.CallerId = new Guid(“D0DED6CA-5A65-E611-80DD-FC15B42877A8”);

// Create Account

Entity account = new Entity(“account”);
account[“name”] = “Peter Parker”;
Guid accountId = orgService.Create(account);

// Who Am I Request

// Guid userid = ((WhoAmIResponse)orgService.Execute(new WhoAmIRequest())).UserId;

catch (Exception ex){
Console.WriteLine(“Exception : ” + ex.Message);

// To Read Connection Strings From <App.Config>

private String GetServiceConfiguration(){
// Get available connection strings from app.config.
int count = ConfigurationManager.ConnectionStrings.Count;

// Create a filter list of connection strings so that we have a list of valid
// connection strings for Microsoft Dynamics CRM only.
List<KeyValuePair<String, String>> filteredConnectionStrings =
new List<KeyValuePair<String, String>>();

for (int a = 0; a < count; a++)
if (isValidConnectionString(ConfigurationManager.ConnectionStrings[a].ConnectionString))
(new KeyValuePair<string, string>

// If one valid connection string is found, use that.
if (filteredConnectionStrings.Count == 1)
return filteredConnectionStrings[0].Value;

return null;

private Boolean isValidConnectionString(String connectionString){
// At a minimum, a connection string must contain one of these arguments.
if (connectionString.Contains(“Url=”) ||
connectionString.Contains(“Server=”) ||
return true;

return false;

Refer MSDN article for more details.