Tuesday, 2 June 2020

Number Input Control - Dynamics 365 Customer Engagement

Hi Everyone,

One more good control which can be used in the place of any numerical or money field is Number Input. This gives flexibility to users to tap the plus and minus button to change a numeric value in increments you set.

Just select the numerical or money field for which you would like to convert to Number Input --> Change Properties --> Add Control --> Select Number Input --> Configure the value that you would add or subtract from the current value when you click on + and  - icons.



Hope this helps.

--
Happy 365'ing
Gopinath

Monday, 1 June 2020

Auto-Complete Control in Dynamics 365 Customer Engagement


Hi Everyone,

Today I was going through the Field properties and checked Controls tab. Just to understand more clicked on Add Control link and somehow Auto-Complete Control grabbed my attention.

What is Auto-Complete Control?

This control filters an item list as you type and lets you select a value from the drop-down list. For example, you can use this control to let users choose from a drop-down list of states or countries/regions.

To understand it more, I have created a custom entity named as Countries and loaded the data in it.

 Navigate to the Customizations area and select an Account form to edit. After the form is open, select the "Country" field and click "Change Properties" -> Controls tab  -> Add Control.

Select Auto-Complete and click on Add


You will get the screen to select the properties. First thing, we need to understand is Source here.
We have two options for Source here Option Set and View.

If you choose "Option Set", you will be prompted to choose an option set.

If you choose "View", you will be prompted to choose an Entity and View then we have to choose the field from Source entity.

Click on Ok to save the configurations.
Make sure you select the display options so that Control is shown accordingly.


It shows on UI as below

After knowing this control, I feel this is not utilized much even though it gives good User Experience.

Hope this helps.

--
Happy 365'ing
Gopinath

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="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script type="text/javascript">

        function onSomeLinkClick() {
            alert("clicked");
        }

        $(document).ready(function () {

        });

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

    </div>
    <div>I am HTML Page</div>

</body>
</html>
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
Gopinath

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
Gopinath

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
Gopinath

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
  • SELECT
  • 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
Gopinath

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.

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

3) Run the below command by replacing Orgname.

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


Hope this helps.

--
Happy 365'ing
Gopinath

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;
    activityParties.push(Sender);

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

    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) {
            console.log(e.message);
        }

    )

Hope this helps.

--
Happy 365'ing
Gopinath

Saturday, 16 May 2020

Show tooltips on Kendo Grid

Hi,

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.

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

CSS
.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
Gopinath

Set fixed height to Kendo Grids

Hi,

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
Gopinath

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();
    globalContext.getCurrentAppProperties().then(
        function success(app) {
            console.log(app);
            console.log(app.appId);
        },
        function errorCallback() {
            console.log("Error");
        });
}
Hope this helps.

--
Happy 365'ing
Gopinath