Shift your focus; Upgrade yourself

Upgrade Yourself

Be it any profession, upgrading your skills is unquestionably significant. Not only does it open the door to new career opportunities, but it also helps you enhance the quality of your life. To keep myself technically updated, I have bookmarked a list of blogs and YouTube channels.. I also frequently check Feedspot’s Top 35 Microsoft Dynamics 365/CRM Blogs, which is regularly updated by the moderators. But is it enough?

For a Business Application Consultant , critical thinking is as important as software skills , and I must say that reading ‘Farnam Street’ enhances your decision-making skills. Shane Parrish who is an ex-spy, investor, and writer, improves your critical thinking ability with every post in his blog “Farnam Street”.

Why Farnam Street?

MR Shane focuses on the importance of cultivating mental models and frameworks to tackle complex issues. The blog ‘guides to decision making’ especially when you’re in a challenging situation. I must say that reading a 3-minute post on Farnam Street equals watching a week of TED or simialr videos. It simply means that you are served with the most appropriate information that you need to boost your decision-making skills regardless of your professional or skillset.

Shane Parrish urges visitors to ‘Upgrade Yourself’ and that’s one of the biggest reasons he is promoting self-betterment over classic self-help fare. He believes that being responsible to yourself is imperative and learning is one of the best investments that you can make in your life.

Photo by Pixabay on Pexels.com

Here are some other ‘Be Better’ blogs that I would recommend:

For me, learning is like entering a world of opportunities. What about you?

Do you want to be a Dynamics 365/Power Platform expert? then docs.microsoft.com is the Key.

When my colleagues are stuck on something, I always encourage them to do their best in Google search and then ask for help in the respective tech community, because good research is always important to nurture knowledge. But having said that, I always ensure that they check the Microsoft docs, if they haven’t, I suggest them to look into docs.microsoft.com.

Googling is a mandatory skill. BUT

Most developers start their career at the same pace and depend on random Google Searches. Even I started my career with a trust in blogs and communities. The blogs and videos are always helpful to make you understand the topics easily, but when you need deep technical knowledge, official documents or SDK documentation is the best source. These documents let you know the capabilities and limitations of the platform you work on.

Let’s take an example, if you are stuck at some point while using Power Apps Functions or D365APIs, what will you generally do? You might search it randomly and copy/paste the available piece of code (like we all do).

Can you imagine what can happen later to the system?

Is the code you copied supported by Microsoft?

Is it the optimal solution for your system and users?

SDK documentation is the answer to all these questions. It is your responsibility to ensure that you are not doing any unsupported customization.

We all know that the official documents are helpful but, do you know why people are not looking into these documents while working on something? It’s because we are all lazy…. These documents contain a broad range of technical information and are not as simple and easy to understand as individual blogs. But for technical knowledge and long-term future in D365 and Power Apps, it is advisable not to go with easy solutions. Reading through the official documents will definitely pay back your efforts. Once you start reading these documents and comprehend the topics, they become your true consultant.

In the start of our career, people may be short on time or lazy to check and read the SDK Documents. It wasn’t different for me either. But back in those days, I came across the blog of Ben Hosk and one of his statements struck me so hard “The CRM SDK can be stubborn, difficult, and renowned for not suffering fools gladly.” Reading this was the time when I decided to look into the Microsoft Documents along with the solutions from other Blogs and Videos available.

Now, referring the official documents for solution has more or less turned into a practice for me. If time does not permit to go through the documents, I would rather expand the deadline rather than compromise on the authenticity and quality of the solution. Moreover, I try to cover the topics during the weekend and learn something new from the official Microsoft Documents. So, if you are not familiar with these documents or fail to refer them even after knowing its benefits, it’s definitely a loss of opportunity to learn new things while at work. 

So, you should never bypass “learning something new with every customization you do”!!!!

Let’s Learn PCF Together

After adding Aggregate Grid Control to PCF gallery, I received many LinkedIn messages saying they love to build PCFs but they cannot as they are not pro UI developers. Trust me, I am not a pro UI developer just know the basics only :(, with the help of Awsome Microsoftcommunity, I managed to build a couple of PCF controls and for the last 6 months, every month am adding a new control to the PCF gallery. So now I have started a short video series of PCF control tutorial for beginners. these are 5 mins videos released once in every 3 days covering only one point per video. Hope this will be helpful for beginners. This is my first YouTube video series so am sure there is a huge scope for improvement 😅

Canvas-Apps for Approvals in Dynamics 365-CE

There are scenarios where we need to configure approvals in Dynamics 365, for example, mark an account as a premium customer after approval or qualify leads after approval etc. We used dialog control to capture approval request and comments but, now dialog controls are depreciated and not advised for use in new projects.

As per Microsoft’s initial announcement

Dialogs are deprecated and are replaced by mobile task flows (available as of the December 2016 update), and business process flows. Both task flows and business process flows will continue to evolve to make the transition easier.

But either tasks flow or business process flow was not a perfect replacement for Dialog. Knowing this pain from users, Microsoft has now modified the announcement.

Dialogs are deprecated, and should be replaced by business process flows or canvas apps

Even though I knew canvas apps can be now embedded in model-driven apps, I hadn’t thought of this option until I came across this new announcement, so tried replicating my approval dialogs with a canvas app and it works fine. Pheww!!!! 🙂

For testing purpose I replicated the dialog for creating approval request for Account entity.

  1. created a canvas app to create approval request.
This sample app changes account status to pending verification and captures the comments in one custom field.

2. Now we need to call this app from account form, obtain the app ID from app details section.

select app details to get the App GUID

3. I need to call this canvas app as a popup when user clicks a button. I created a custom button for account entity-> added a JavaScript as button action to call an HTML web-resource and embedded my canvas app in this html I-frame.

<html><head>
<title>Approval</title>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body style="padding: 0px; font-family: arial; overflow-wrap: break-word;" onload="LoadPowerApp()">
<center>


<iframe id="Approval" width="800" height="600"></iframe>



</center>
<script id="myScript">
function LoadPowerApp()
{
var AccountID = window.parent.opener.Xrm.Page.data.entity.getId().slice(1, -1);
var url ="https://web.powerapps.com/webplayer/iframeapp?source=iframe&appId=/providers/Microsoft.PowerApps/apps/56123673-f45c-4b96-b9e6-ece1b0a8069a&ID="+AccountID;
document.getElementById("Approval").src=url;
}
</script>


</body>
</html>

I know you have many questions now. "https://web.powerapps.com/webplayer/iframeapp?source=iframe&appId=/providers/Microsoft.PowerApps/apps/56123673-f45c-4b96-b9e6-ece1b0a8069a&ID="+AccountID;

This is the key and I will breakdown it into parts “https://web.powerapps.com/webplayer/iframeapp?source=iframe&appId=/providers/Microsoft.PowerApps/apps/APP GUID&CUSTOM PARAMETER NAME=”+PARAMETER VALUE

App GUID I explained in step 2, now regarding custom parameter, I deliberately didn’t mention it when we discussed the app creation and kept for this section. When we open this canvas from an account form(like we start a dialogue) the app needs the record GUID to update the account status

I have used form control in the canvas app and filtered the item using the ID Parameter.

4. Now try your button and you can see the magic.

You can download the sample APP from TDG Power Apps bank.

Please note this is a basic app I tried for testing purpose and needs many improvements to use in a live project. you are always welcome to discuss with on this app.

Hope this helps….. 🙂

Microsoft Dynamics CRM is behaving weird!!! (Common troubleshooting tips)

Sometimes your on-premise CRM system will show, some weird behaviors like workflows are not executing / plugins are not working / data imports are failing without any data issues etc…

I have faced certain issues like the entire system is not working , system will  show error messages without any logs, the only message it  displays is “an error has occurred”.

Following are the common issues you can check in such situations.

Ensure CRM Asynchronous services are running

From the server Administrative Tools select Services, and if the CRM Asynchronous services are not running ensure to start the services (if the Asynchronous  services are not running CRM will stop working).

Ensure CRM Sandbox services are running

From the server Administrative Tools select Services, and if the CRM Sandbox services are not running ,please start the services. If the Sandbox services are not running CRM will stop working or the normal system jobs will fail without showing any valid errors .

Check IIS

Ensure the following in IIS

CRM application pool and CRM  website are up. Try browsing the CRM website from IIS.

Make sure your SQL server and Reporting services are up

Ensure your local machine time is in sync with the server time 

This may sound funny but trust me this simple point can save your many productive hours.

Recently my system failed to  perform certain operations and I wasn’t able to connect the Xrm tools too. When I debugged I got the keyword “past time” , then I identified that the server time was different from my local machine.

If you have tried all the above steps and still you are not able to identify the issue,please check the server event viewer this may give you some details regarding the failure.

Hope this helps!!!…  🙂

 

 

 

 

 

On demand backups for CRM Online instance

With on demand backups, you can make your own backup before making some significant customization change or applying a version update.

CRM Online Administrator Center

About CRM managed on demand backups:

  • You can back up Production and Sandbox instances.
  • You can only restore to a Sandbox instance. To restore to a Production instance, first switch it to a Sandbox instance. See Switch an instance.
  • Only CRM Online 2016 Update 1 or later versions are supported for backup.
  • On demand backups are retained for up to three days. Check your expiration date.
  • On demand backups are identified as created by someone other than System and by the presence of Edit | Delete | Restore in the details section. System backups only have Restore.

Backup and restore CRM online instance

Configure SLA for Custom Entities

In previous releases, you could create SLAs only for case records. With CRM Online 2016 Update 1 and CRM 2016 SP1, you can now create enhanced SLAs for entities that are enabled for SLA. A system administrator or customizer can enable SLAs for the following entities and also for custom entities and custom activities:

  • Account
  • Contact
  • Order
  • Invoice
  • Quote
  • Opportunity
  • Lead
  • All activity entities like email, phone, and appointment except recurring appointment and its instances.

 

To enable SLA for custom entities you can select Enable for SLA option in the entity.

Untitled

once the entity is published you can configure SLA using the same steps we used for case, system will ask for the related entity at the time of SLA creation  .

Untitled

Please note that only enhanced SLA is available for custom entities , standard SLA can be used only with case entity.

To create see how to configure SLA please follow the link :Define SLA

To add a timer control to the form please follow : Add Timer

Hope this was helpful……..

 

 

WEB API- Part 5 : Get lookup text

Get lookup text using WEB API

Following code will fetch the originating lead lookup text and Id from an opportunity .

var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/opportunities?$select=_originatingleadid_value&$filter=_originatingleadid_value ne null", true);
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) {
            var results = JSON.parse(this.response);
            for (var i = 0; i < results.value.length; i++) {
                 var _originatingleadid_value = results.value[i]["_originatingleadid_value"];// Id
                 var _originatingleadid_value_formatted = results.value[i]["_originatingleadid_value@OData.Community.Display.V1.FormattedValue"];// text value
            }
        }
        else {
            alert(this.statusText);
        }
    }
};
req.send();

WEB API- Part 4 : Get option-set text

Get option-set text and value using Web API

Following code fetches lead source option-set value and text from lead entity.

var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/leads?$select=firstname,leadsourcecode&$filter=fullname eq 'Alex%20Eric'", true);
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) {
            var results = JSON.parse(this.response);
            for (var i = 0; i < results.value.length; i++) {
                 var firstname = results.value[i]["firstname"];
                 var leadsourcecode = results.value[i]["leadsourcecode"];
                 var leadsourcecode_formatted = results.value[i]["leadsourcecode@OData.Community.Display.V1.FormattedValue"];
            }
        }
        else {
            alert(this.statusText);
        }
    }
};
req.send();

Please note the following code

" var leadsourcecode_formatted = results.value[i]["leadsourcecode@OData.Community.Display.V1.FormattedValue"];"

“fields name@OData.Community.Display.V1.FormattedValue” will give you the text value of the filed.

Note : Don’t forget to add req.setRequestHeader(“Prefer”, “odata.include-annotations=\”OData.Community.Display.V1.FormattedValue\””);
in the request header

WEB API- Part 3 : Retrieve records modified within last few hours

Using Query Functions:  Retrieve records modified within last few hours 

Query Functions  are intended to be used to compose a query. These functions can be used in a manner similar to the standard library functions,

The following example shows how to use the “LastXHours” to return all account entities modified in the past 12 hours.

var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() +/api/data/v8.1/accounts?$select=name,accountnumber&$filter=Microsoft.Dynamics.CRM.LastXHours(PropertyName=@p1,PropertyValue=@p2)&@p1='modifiedon'&@p2=12

For complete list of query functions please follow the link Query functions.