Category: Dynamics 365 CE

{Known Issue}Date and Time fields behaves differently in UCI on upgrade

Hello Reader,

I am writing this article to tell you about the known issue of date and time in UCI on upgrade from classic to UCI.

Before this, user had reported that button image and entity icon was shown as jigsaw in UCI for that I had written a blog where I elaborated the root cause and solution of it for reference please click here

Problem Statement: Business reported that written custom logic on date and time field is not working fine(One day less or more than expected) and users from different time zone are experiencing incorrect date value in field.

Root Cause: I tried to dig into it and went to the field properties. As we know that we have Format and Behavior for the field. So, In classic we don’t have control to change the behavior of field. it is Date only by default and this is the catch or in another word I would say this is the only root cause of problem. 🙂

when system upgrade from classic to UCI, the date and time field’s behavior becomes to “User Only” which shows data based on User local time.

Earlier mechanism was working on “Date Only” behavior and that’s why the user faced the data inconsistency.

screen from classic

Solution: Now in UCI, we have the flexibility to change the behavior as listed below:

1.User Only(It shows data based on the user time zone{If in case you have question that what is user time zone then it is nothing but your Laptop/Desktop time setting or your dynamics 365 CE personal setting.})

2.Date Only(It displays data from crm data base where it stores time as 12:00 A.M. always or in other words it shows date in UTC format )

3. Time Zone Independent(it is independent from any conversion and will show you the data exactly what is stored in data base.

Note*: In classic, date and time field’s default behavior is “Date Only”.On upgrade and on creation, date and time field behavior sets to “User Only” by default.

In terms of resolution, I have two option to fix it.

  1. Make the main form to Time-Zone Independent. Nothing to do with date and time field.
  2. Change the behavior of field to Date Only.

And I opted out the 2nd option and change the field behavior as same as in classic which is exactly sorted the problem.

This was challenging for me because I was unaware from the fact which I wrote down in note section.

Bonus Tip : It is advisable that birthday date should have the “Date Only “behavior. If Birthday is being used with time then behavior should be “Time-Zone Independent”

I am hoping that my experience will help you.

May the dynamics power be with you.

{Tip}Switch to Classic even if end users are using UCI [Dynamics 365 CE]

Hello Reader,

Hoping you are safe during this pandemic.

Apparently, users are using UCI(Unified Interface) and they had reported couple or the other defects in UCI. Therefore, I had to investigate and need to tell them whether it is UCI or a classic issue and what is the root cause of it.

In my scenario, entire system is working fine in Classic but couple of the things are not performing well in UCI.

Thus, I had to switch it back to classic for the investigation purpose without loosing any configuration and customization.

Fixed Configuration: My organization system setting is settled up for UCI(i.e.End user only will use UCI)

Question raises that how to switch to classic when you can’t loose any existing data,configuration/customization.

Answer is, Just append force classic to true and it will navigate to old school.

Note*: If you find that this tip is not working somehow. Try it incognito mode. Basically there shouldn’t be any browser history. You should start it fresh.

orgurl/main.aspx?forceclassic=1

Hope it helps.

May the dynamics power be with you.

5 Interview Question of Dynamics 365 Customer Engagement {Consultant}

Hello Readers,

Since it is peak time of interview and all the seekers are being passed through with it. I have a few questions which had been asked in my recent interview. I also shared another set of 5 interview questions. You can click here to refer them.

Question 1: What is the Execution Order. Let’s say Execution order set 1 to asynchronous plugin and 2 to sync plugin. What will be the execution order.

Answer: Execution order is the order which run the plugin on the same message(create/update and etc).order will be the same as async plugin will trigger 1st with execution order 1 but it will not wait for its completion and sync will execute in second order.

Question 2: What are the changes which Microsoft has brought from 2011 upto now.

Answer: Since it is simple question with vast complexity and unfulfilled satisfaction of interviewer on it, as there are many more things to tell to your interviewer.Here I am highlighting few of them.

Advanced filtering,This capability brings a lot of Dynamics 365’s Advanced Find from classic web to unified interface. Advanced filtering is embedded on entity sub grid view, user need not to go to advance find every time for creating an expression.

Lookups in the Unified Interface now support the enhanced filtering capabilities which includes for only my records and related records only for web.

Unified Interface UCI gives flexibility to see/handle your CRM on handy mobile.Earlier Entity form was bound to web client now it is platform independent.

Model Driven App is nothing but your Dynamics CRM in app module.

Canvas App,where customization takes place separately.

Question 3: What is the security Model in Dynamics CRM?

Answer: To control data access, you must set up an organizational structure that both protects sensitive data and enables collaboration. You do this by setting up business units, security roles, and field security profiles.

So basically, it is assignment of security role to user based on Teams and BU.

Question 4: Let’s say security role is not assigned to user to see the particular entity, will that entity be visible in Advance Find.

Answer: Yes, Entity will be visible in Advance Find.

Question 5: While upgrading classic view to UCI what are the known issues?

Answer: Custom Ribbon Button showing jigsaw image{Solution: Add Modern image using svc webresource.}

Entity Icon not visible{Solution: Choose 16×16,32×32 images }

Getting form context error on page on load{Solution: Passed execution context by checking the check box.}

Button is not visible on subgrid.{Solution: Add Subgrid view of entity in Model Driven App.}

Hope it will help in your interview preparation.

May be the Dynamics Power with you.

{Tips -Tricks}While working on Client Scripting in Dynamics 365

Hello Reader,

Playing with Java Script is common to all Developers and Dynamics 365 Technical Consultant, Therefore, there are some of the tips and trick which should be followed while working with Java Script.

Some of the tips and tricks are listed below :

Tip 1* Create Namespace of Web-Resource: During working with Web-resource, It is a good practice to use Namespace. Sometimes, It becomes big task to investigate error in large and complex Implementation and that too frustrating if it is causing from the silly mistake and took millions of hours for investigation hahaha

One of the reason is, There are same name function in other Web-resources too. So, during compilation calling function gets confused which function to refer to as it is getting multiple references.

Let’s take an Example.

Scenario 1: If Namespace is not defined.

There are three Web-Resources A and B and C, function xyz is written in Web-Resources A and B, Web-Resource C’s function pqr is calling-function xyz,

During compilation function pqr gets confused as there are two different paths to refer. 

function pqr()
{
xyz();
}

Scenario 2: When Name space is defined

a is the namespace of Web resource A, b is the namespace of Web resource B and c is the namespace of Web resource C and taking the same scenario as above xyz function is being called by pqr with no confusion since Namespace is defined and there is only one way to traverse.😊

function pqr()
{
a.xyz();
}
function pqr()
{
b.xyz();
}

Tip 2* One Onload function: Keep all the function in one function, which is being called on-load event of form. It enhances System Performance and takes less time on load.

Page_OnLoad = function () {
mno();
stu();
xvw();
} 

Tip 3* Don’t register On-change Event handler programmatically: According to developer’s choice, Attribute on-change event should be configured on from. Try to avoid writing formContext.getAttribute(arg).addOnChange(function); in java Script.

To Configure follow the below steps:

>>Go to the Field Properties

>>Click on the Events tab(third from last)

>>Register your function.

Tip 4* Have Common Web-resource commonly used function like WebAPI Call: Should have common Web resource ready where you can have all the commonly used function like Web API Calling function for retrieve Multiple and Single Records or retrieve user access based on Security Role.

if (typeof (MSP) == "undefined")
{ MSP= { __namespace: true }; }
MSP.Common = {
    CommonLibrary: function () {
    },
    RetrieveSingleRecord: function (entityName, entityId, columns) {
        var results = null;
        var entityId = entityId.replace("{", "").replace("}", "");
        var req = new XMLHttpRequest();
        req.open("GET", encodeURI(Xrm.Page.context.getClientUrl() + "/api/data/v8.0/" + entityName + "(" + entityId + ")?$select=" + columns + ""), false);
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("Prefer", "odata.include-annotations=\"OData.Community.Display.V1.FormattedValue\"");
        req.onreadystatechange = function () {
            if (this.readyState === 4) {
                req.onreadystatechange = null;
                if (this.status === 200) {
                    results = JSON.parse(this.responseText);
                }
                else {
                    results = this.statusText;
                }
            }
        };
        req.send();
        return results;
    },

    RetrieveMultipleRecords: function (entityName, Columns, filter) {
        var results = null;
        var req = new XMLHttpRequest();
        req.open("GET", encodeURI(Xrm.Page.context.getClientUrl() + "/api/data/v8.0/" + entityName + "?$select=" + Columns + "&$filter=" + filter + ""), false);
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("Prefer", "odata.include-annotations=\"OData.Community.Display.V1.FormattedValue\"");
        req.onreadystatechange = function () {
            if (this.readyState === 4) {
                req.onreadystatechange = null;
                if (this.status === 200) {
                    results = JSON.parse(this.responseText);
                }
                else {
                    results = this.statusText;
                }
            }
        };
        req.send();
        return results;
    },

    __namespace: true
};

Tip 5* Try avoid to use Global variable: Due to conflict between functions sometimes global variables refers incorrect values which cause error in other function and creates unnecessary pain to developers.

Hope it helps.

May the Dynamics Power be with you!

Azure Logic Apps:When a HTTP request is received|used case[Biz talk Server integration with Dynamics 365]

Hello Microsoft Enthusiast,

Azure is LCNC(low-code/no-code)development platform.There are several triggers available.It is always exciting to work and explore them.So I am demonstrating one of them i.e. When a HTTP request is received.

Scenario: This is the integration between Biz talk Server and Dynamics 365. Azure Logic Apps listens Biz talk Server whenever it receives JSON object and perform the further crud operation. My scenario operation is : If Account exists in Dynamics 365 then update the Account’s address details based on the received ‘Account Number’ from the biz talk server’s request in the Logic Apps.

Let’s start as follows:

#1: Create a logic apps with the template: ‘When a HTTP request is received’. When you click on ‘Save’ button endpoint will be generated automatically and click on ‘Use sample payload to generate schema’.After this a window will popup, paste the JSON(It is prerequisites for you and will differ case to case.) in pop-up window. In this way, ‘Request Body JSON Schema’ will get structured automatically.

Some of the sensitive data has been hidden in some of the screen shot.

#2: Initialize the variable for ‘Account Number’ and ‘Account ID’. Query the ‘List records’ to check whether the Account is present or not in Dynamics 365 based on the received Account Number from Biz talk request.

#3: loop the received input in ‘For each’ loop. Put the condition where Account Number is equal to Biz talk Account Number.

#4: If condition is true then set Account’s Guid in Account ID variable and update the address details in Acoount. Refer the below Screen.

#5: Send the ‘200’ Status Code as Response message to Biz talk Server. So that Biz talk get to know that sent request has been processed successfully. 😊

Test: Once Logic Apps received request from Biz talk, It updates Address details of particular Account.

Screen from Dynamics 365

If you want more clarification/information.Don’t forget to comment.I will be happy to assist you. 🙂

Hope it helps to some extent.

May the DynamicsPower be with you!

Azure Logic Apps|used case[Dynamics 365 Integration with HubSpot]

Azure Logic Apps|used case[Dynamics 365 Integration with HubSpot]

Hello Reader,

In my previous post, I had created custom Connector (If you want to see ‘how’ click here) and now time has come to use it. So, here I am integrating Dynamics to HubSpot using Microsoft Azure Logic Apps.

While working with Azure Logic App,you won’t have to write code in many cases. But if you have to, you will create code snippets with Azure Functions and run that code on-demand from Logic Apps.

Detailed steps are as below:

Step 1: Login to portal.azure.com with your credentials and create ‘Resource group’, if you already have one, kindly use that. I have created crm-int-hubspot Resource group for the demo purpose.

Step 2: Create a Logic App and name it as per your wish. Click on ‘Create’ and wait till it get deployed successfully to Resource group. Start with blank Template.

Step 3: Look for the Trigger. In my scenario, I opted Common Data Service then chose the trigger when contacts get created. After that map the dynamics 365 environment’s information accordingly.

Step 4: Now the question arises for connector. There is no out of box connector available yet, Therefore, I have created custom connector in my previous blog, so continuing with it, I selected Hubspot_CreateContact in Custom tab and below it chose Action Create Contact in HubSpot on creation of contact in Dynamics 365 as shown in below screen.

Step 5: Now add the value of HAPIKey (stands for HubSpot API Key,which interact with information and is unique for each instance) and properties. You can add any property which is defined in hubSpot. For the demo purpose, I am taking firstname, lastname and email 🙂

Step 6: Save Logic Apps and test it. 😊

Testing : Log-in to Dynamics 365 and create contact. The same contact will be created in HubSpot. Bingo!

Creating contact in Dynamics 365.
Same created in HubSpot.

With this, I am done with my HubSpot series. Stay tuned to get more live industry scenario.

Hope it helps to some extent.

May the DynamicsPower be with you ! 🙂

Azure Logic Apps Custom Connector|used Case[To create Contact in HubSpot]

Hello Reader,

Have a quick look on how to create Azure Logic App Custom Connector to create contact in HubSpot.

Disclaimer: I am assuming that you are familiar with Azure and have Azure Subscription to login on portal.azure.com with your credentials (If Not, you can comment to get more information/clarification.)

The steps are as follows:

Step 1: Create a new Resource Group if you don’t have, else start with the existing one like me. Go to the Resource Group and add Logic Apps Custom Connector and name your Custom Connector as per your wish and click on “Create”. Refer below Screen. Wait till it get deployed to resource group successfully.

Step 2:  Start with Rest API-end point and OPEN API file

Step 3: Scroll down a bit and fill the Host API base url (Currently working in General Tab) and click on the “Security”, you will be moved to Security tab.

Step 4: I chose No Authentication Since it will authenticate from HAPI key in its next Definition tab. Click on “Definition”.

Step 5: Welcome to Definition tab, Add Action by entering Summary, Description, Operation Id as below:

Step 6: Scroll down a bit within the same page and click on “import form sample” which you can find under ‘Request’.

Step 7: Please remain on the same page, you will get a pop-up window immediately on the right-hand side to fill-in the request information as:

Verb-Post,

URL-https://api.hubapi.com/contacts/v1/contact/?hapikey=demo,

Body

 {   
"properties":
[
{ "property": "email" },
{ "property": "firstname"},
{ "property": "lastname"},
{ "property": "website"},
{ "property": "company"},
{ "property": "phone"},
{ "property": "address"},
{ "property": "city"},
{ "property": "state"},
{ "property": "zip"}
]
}

After clicking on “Import”, the pop-up window will disappear.

Step 8: Click on “Update connector”, and you are good to go with your custom connector. You will get notification” Custom Connector has been successfully updated.”

This Connector will be used in my next blog. Stay tuned to see it in action.

Hope it helps to some extent !

May the DynamicsPower be with you ! 🙂

formContext.ui.formSelector(Client API reference)|used case[Set From based on optionset value in UCI]

Hello Folks,

Is it not a good learning experience,where you do relative comparison? I wrote a JavaScript to understand how formContext.ui.formSelector and its sub property work completely.

Please, take a look on high level overview of formContext.ui.formSelector which is tabulated below.

Scenario: I took the scenario where will set entity form based on option set value.This scenario covers ui.formselector entirely, likewise as:

  1. formContext.ui.formSelector.items.get();
  2. formContext.ui.formSelector.getCurrentItem.getId();
  3. formContext.ui.formSelector.getCurrentItem.getLabel();
  4. formContext.ui.formSelector.getCurrentItem.navigate();

Implementation: Find the code snippet below:

var formContext;
function setForm(executionContext)
{
formContext = executionContext.getFormContext();
if(formContext.ui.getFormType()==1)
{
return;
}
if (formContext.ui.getFormType()==2)
{
var caseType = formContext.getAttribute(logicalname).getValue();
switch(caseType)
{
case 1:
changeForm(“Claim”);
break;
case 2:
changeForm(“Trial Order”);
break;
default:
changeForm(“Case for Interactive experience”);
}
}
}

function changeForm(formName)
{
var currentForm = formContext.ui.formSelector.getCurrentItem();
var availableForms = formContext.ui.formSelector.items.get();
if (currentForm.getLabel().toLowerCase() != formName.toLowerCase())
{
for (var i in availableForms)
{
var form = availableForms[i];
// to find a form based on the name
if (form.getLabel().toLowerCase() == formName.toLowerCase())
{
form.navigate();
return true;
}
}
}
}

Call this function on page load event and make sure that this code is present on all other forms.

Testing: I am creating case record from default case form by putting up case type as Trial order.Once record is saved.It will navigate screen to trial order case form and have similar behavior for claims case form too.

Hope it is informative! 🙂 Keep dynamics-power with you.

Fix – Custom Ribbon Button’s icon is showing as Jigsaw Image in UCI

Hello Everyone!

While I was working on Ribbon Workbench customization, one of my colleague addressed me that custom button icon is showing as jigsaw image in UCI interface whereas button’s icon is showing as desired in classic Interface. My colleague was questioning if it is a Microsoft issue or anything else which is missed to be done?

Workaround:

I went to Ribbon Workbench Customization, There I noticed one more new input i.e. ModernImage. Modern Image supports Vector format (SVG) and responsible for UCI(Unified Client Interface) visibility.

Therefore,16X16 image, 32X32 image is responsible for Classic View. Even you can test it at your own. Remove these 16 or 32 png from Ribbon Work Bench then publish it, you will not see them in Classic Interface😊

Fix:

All you need to do it. Create a Vector format (SVG) web resource. Go to Ribbon Workbench, Select your Solution, Browser your SVG icon image under Modern Image and then good to go to publish it.

Hope it helps for quick fix!