Friday, 29 May 2020

Save and Close not working on the forms in Dynamics 365 CE

Hi Everyone,

Today I was working with HTML Webresource, we have some Hyperlinks on that. We have observed very strange issue, Save and Close button on the from is not working on first click after we click on the hyperlink in the HTML Webresource and it works when we click for second time.

Here is the sample source code that we had and if we remove the HTML webresource or if don't click on the hyperlinks every thing is working fine. We were sure that there was something in HTML that is creating the issue.

<html lang="en" xmlns="">
    <meta charset="utf-8" />
    <script src=""></script>
    <script type="text/javascript">

        function onSomeLinkClick() {

        $(document).ready(function () {


        <a id="SomeLink" onclick="onSomeLinkClick()" href="#" title="Some Link">Some Link</a>

    <div>I am HTML Page</div>

After checking the code slowly, we found that in href property # was given and that was causing this issue. As the hyperlinks has # in href, when we click the link, it is pushing the current URL to browser's history stack and due to that we must click "Save and Close" 2 times to go back to list page. Technically Save and Close button just does "Save" and do "history back".

Removing # from href property of Anchor tag resolved the issue.

<a id="SomeLink" onclick="onSomeLinkClick()" href="" title="Some Link">Some Link</a>

Hope this helps.

Happy 365'ing

Tuesday, 26 May 2020

File and Image Data Type Fields in Dynamics 365 Customer Engagement

Hi Everyone,

Today I was creating some fields as per my requirement in Dynamics 365 Customer Engagement and found a datatype as File. I know that File Type was available quite sometime in CDS but it can used only via Canvas App.

To make our lives exited, File Type is available on Model Driven App now. Along with this, we can create multiple fields of type image in single entity. Well there was an Entity Image that has been available for some time now but that only allowed for one single image to be associated with a record.

I have created two fields as below.

Maximum file Size is set to 32 MB by default and it can be extended till 128 MB and this would become read-only after creating a field so choose the correct size while creating the fields.

I have created a tab and place both fields on the form and they are working like a charm.

Hope this helps.

Happy 365'ing

Monday, 25 May 2020

Filtering is getting better - Dynamics 365 CE

Hi Everyone,

Today I was testing some functionality as per my requirement on home page grids and was applying some filters to see the right data. It seems the filtering has been bit improved in the latest version.

I have observed two things.

1) Lookups - When you try to filter on column of type lookup, you will see the list as a drop down and that too very fast. Not sure what kind of query they have applied and when we do, certainly it is not that much fast :)

2) Activities Grid - We can filter by Activity Type now.

These are very small changes but very useful and create good impact to the customers.

Hope this helps.

Happy 365'ing

Friday, 22 May 2020

Query CDS/Dynamics 365 data using SQL Query

Hi Everyone,

You know A SQL data connection is available on the Common Data Service endpoint. Although I am a big fan of FetchXML which makes our lives easier as we don't need to worry about backend things and our powerful Advance Find always helps us to frame Fetch XML in a right way. Sometimes(Debates with Salesforce Team as they always mention that they have SQL Workbench) even I felt that there should be some way in Dynamics as well and finally here it is.

Use SQL to query data (Preview)

This is one of most awaiting feature from many years and is in preview now. 

Points to be considered before you start using it.

1) Download and install 18.4 or latest version of SQL Server Management Studio
2) Only Azure Active Directory Authentication is supported. No SQL and Windows authentication is supported )It completely makes sense as well)
3) Below are the supported operations.

  • Batch operations
  • Aggregation functions (i.e., Count() and Max() functions)
  • UNIONs and JOINs
  • Filtering

4) No updates/Inserts are allowed as this is a read-only connection.

The following Common Data Service datatypes are not supported with the SQL connection:

binary, image, ntext, sql_variant, varbinary, virtual, HierarchyId, managedproperty, file, xml, partylist, timestamp.

How to connect?
  1. Open SSMS
  2. Give Server name as the organization address URL followed by a comma and the port value of 5558.
  3. Authentication - Azure Active Directory-Password
  4. Give Username and Password

If you receive below error, please follow the steps mentioned here.
And we are good to run SQL queries on CDS.

Hope this helps.

Happy 365'ing

Using SQL to Query CDS Data - Login failed: TDS protocol endpoint is disabled for this organization

Hi Everyone,

I was exploring on preview feature on how can we connect SQL to Dynamics Data and while connecting to CDS received below error.

"Login failed: TDS protocol endpoint is disabled for this organization."

Follow below steps to solve it.

1) Download the OrgDBOrgSettingsTool i.e. CRM2016-Tools-KB4046795-ENU-amd64 from here and run it.
2) Change CRM URL's and Connections in the Configuration File.
Line 17  - Discovery Service URL
Line 21  - Version like Online or OnPrem.
Line 25  - Username
Line 31 - CRM Service URL

Add below runtime tag after ApplicationSettings.

<AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false"></AppContextSwitchOverrides>

3) Run the below command by replacing Orgname.

Microsoft.Crm.SE.OrgDBOrgSettingsTool Update /u <Orgname> EnableTDSEndpoint true

Hope this helps.

Happy 365'ing

Thursday, 21 May 2020

Create Email record in Dynamics 365 CE using JavaScript

Hi Everyone,

I know this could be very simple as we are doing this from ages but somehow I couldn't get this piece of code very easily.

Code for creating email record using JavaScript in Dynamics 365 Customer Engagement. Important thing here to understand more on Activity Party Participation Type Mask. Go through Microsoft Docs for more information on the same.

    var activityParties = []
    var Sender = {};
    var Receipent = {};

    var userId = "21EFAD11-353B-4238-93BB-65015F448E8A";

    // From - Participation Type Mask = 1
    Sender["partyid_systemuser@odata.bind"] = "/systemusers(" + userId + ")";
    Sender["participationtypemask"] = 1;

    // To - Participation Type Mask = 1
    Receipent["partyid_systemuser@odata.bind"] = "/systemusers(" + userId + ")";
    Receipent["participationtypemask"] = 2;

    var createEmailRequest = {
        "description": "This email is created using JavaScript Code",
        "regardingobjectid_account@odata.bind": "/accounts(bec28e1e-ab87-ea11-a817-000d3a19245f)",
        "subject": "Email using JavaScript",
        "email_activity_parties": activityParties

    Xrm.WebApi.createRecord('email', createEmailRequest).then(
        function success(Email) {
            console.log("Email has been created");
        function Error(e) {


Hope this helps.

Happy 365'ing

Saturday, 16 May 2020

Show tooltips on Kendo Grid


Today I got an requirement to show the tooltips on each column of the grid. I was able to achieve it very easily by adding the below code but the tooltip was showing with black background. I had to invest sometime to understand the how styling for tooltip works. We can use CSS like below.

            filter: "td:nth-child(2)", //this filter selects the second column's cells
            position: "right",
            content: function (e) {
                var dataItem = $("#grid").data("kendoGrid").dataItem("tr"));
                var content = dataItem.Text;
                return content;

.k-tooltip {
            background: #ffffff !important;
            text-shadow: 0 0 black;
            color: black !important;
            box-shadow: 0 0 0 1px #ccc !important;


Hope this helps.

Happy Coding

Set fixed height to Kendo Grids


We all know how great Kendo Controls works and the most famous one among all the controls is Grid.

Today l got an opportunity to work on Kendo Grid and my requirement was to set the Fixed height to the grid irrespective of the rows. Somehow I didn't get the below piece of the code/style to make the grid fixed easily and adding it here so that it would help others.

Just add the below to your CSS and it works. 

.k-grid .k-grid-content {
            min-height: 75%; /*Adjust Percentage as per your requirement*/
            max-height: 75%; /*Adjust Percentage as per your requirement*/

Hope this helps.

Happy Coding

Wednesday, 6 May 2020

How to Get the AppId of Model Driven App in Dynamics 365 using JavaScript

Hi Everyone,

Today I was working on something and we need to get AppId in JavaScript. We all know it is available on URL and we can get it from there but we cannot really depend on URL as it is generated by Product and it might change. 

After quick check, I found that we can easily get AppId using the below code.

var globalContext = Xrm.Utility.getGlobalContext();
        function success(app) {
        function errorCallback() {
Hope this helps.

Happy 365'ing

Saturday, 2 May 2020

Resource not found for the segment - Power Automate

Hi Everyone,

Today I was working with Power Automate and the requirement was simple on the update of the case status, we have to create an entry in the Custom activity entity. Obviously, this is simple and we don't want this operation to be synchronous, hence we have chosen to do it using a Flow.

After working on Flows for this requirement, I understand the real meaning of "Simple to understand but difficult to master." The reason behind this statement was the flow we have written as below was not working and failing showing an error message as "Resource not found for the segment...".
Here is the Create Record step that was configured.

After quick check, came to know that issue was with the way of referencing attributes. We have to pass lookup values in "Odata Id" format as below


In my scenario, for case lookup I have given as /incidents/(GUID) and it started working.

Hope this helps.

Happy 365'ing

Common Data Service vs Common Data Service (Current Environment) - Power Automate

Hi Everyone,

Today one of my team members asked on what are the difference between Common Data Service and Common Data Service (Current Environment) and why I always mention to use CDS Current environment connector. Here is the explanation I gave.

There are 2 connectors available for CDS in Power Automate

1. Common Data Service
2. Common Data Service (Current Environment)

Well, in the above image both names are almost same and how do you differentiate between them? We just have to hover the mouse on it and you will see the name as a tool tip and also there are ...(three dots) at the end of the name mentioning something is hidden in the second icon. If you are not able find Common Data Service (Current Environment) connector, you might be creating Power Automate outside of CDS solution.
There is only trigger for CDS Current Environment as highlighted below and CDS four triggers and I I see one extra trigger "The record is selected". Haven't explored much on it, will come back on this in other post.

Actions and Life cycle management are the huge differences between Current Environment and normal Connector.

CDS - Current Environment
The thing which is most useful in our development scenarios is "Perform an unbound action".  It provides the ability to trigger a Common Data Service (Dynamics 365) action. See screenshot below for examples.


The important one that makes Current Environment connector unique while managing the Flow Life cycle. The Common Data Service (current environment) connector has an advantage when deploying a solution from one environment to another. e.g. promoting from Dev to Test to Prod through export/import. In this instance, the Common Data Service (current environment) connector automatically connects to the CDS environment that the solution has been imported into. This means that as soon as the solution is deployed the flow can be triggered and will run.

In simple words, use the Common Data Service connector for automating personal tasks that interact with CDS or Dynamics 365 data. Use the Common Data Service (current environment) connector for automating business processes involving CDS or Dynamics 365 where the flow can be promoted through different environments via solution import without any issues.

Hope this helps.

Happy 365'ing

Friday, 1 May 2020

How to Enable, Configure and Use Sales accelerator - Dynamics 365 Customer Engagement

Hi Everyone,

Sales Accelerator is a preview feature and not meant for Production Use. Follow Microsoft Docs for officially confirmation the launch. 

"The Sales accelerator helps sellers in your organization increase their sales productivity and prioritize activities for the day through the work list available in Sales Hub app. A sales manager uses the sequence designer to create a sequence of activities—separated by time intervals—including emails, phone calls, and tasks. The sequence is then applied to leads or opportunities, and assigned to a seller automatically according to your organization's sales strategies."

In simple words, this is another tool in the Dynamics 365 Sales Insights toolbox which sales managers and sales reps can utilize to stay on top of their top leads and opportunities. Here everything revolves around Sequence. A sequence is more of a checklist and is made up of activities that needs to be taken place in a certain order by Sales Reps. Sales Manager might wants his team to follow the steps on Lead like first send an email, call them in 24 hours and follow up at some point of time. These events can be configured in Sequence.

Enable Sales Accelerator

Sign in to Dynamics 365 Sales Hub, and go to Change area > Sales Insights settings.

On the site map, under Acceleration, select Sales accelerator (preview).

On the settings page, select I agree to the preview terms and conditions to enable the preview.

Select Get started.

Once you click on Get started, you will see the below where you can create a Sequence and start using Sales Accelerator. Just scroll down a bit, you will see a setting which is enabled by default on Lead and Opportunity and security roles. For now, I have selected All Security Roles and Published.

Make sure you have published the settings before creating the Sequence. Otherwise, you will see an error saying "Sequence is not enabled for this organization. Please enable it for creating a cadence"
Let's create Sequence now. I have selected Lead.

As mentioned above(highlighted), let's take the same example.

Once you are done with configuration of the steps, activate the Sequence. Keep in mind that the sequence or any of the steps can no longer be edited after activation.
Let's create a Lead and see what's happening. Once we have the lead, connect it to the Sequence from the Homepage grid.

If users need to disconnect from a sequence, they can do this by navigating to the ‘Sales Insights Settings’ area, selecting ‘Sequences’ and opening the sequence. The Connected Records tab is where we can see all the connected lead or opportunity records. Users can disconnect the records from here by selecting the records and clicking the ‘Disconnect’ button on the grid.
Click on Sales Accelerator on the left Navigation pane to check how it works.

You will see the record that has been connected, opened with the information and showing the steps to be taken care like send an email and other steps in the Upnext Widget.

Once you click on the email if the Template is selected in the sequence, it will open email window with the template else normal window by automatically populating To and Subject.

Users can also Skip or Postpone items from the widget and move forward with the next steps.

This way we can enforce the Sales Reps are following right process to get the deals closed.

Hope this helps.

Happy 365'ing