Dynamics 365 – Filter lookup with FetchXML (and how to deal with invalid XML format)

By Ritchey Hazeu

In some situations you can’t use the standard filtering options Dynamics 365 has to offer. For example when you use the same entity twice on a form. And you would like to lookup a new field and only filter it on the second entity.

In these cases you can use Javascript to Filter the Lookup yourself. Let’s say we are using the Order entity and want to filter a new field, let’s say Contact and filter it only on the lookup to Order on the Order form, not to the Order itself.

We will create the webresource and place it on OnChange of the Lookup. Don’t forget to check both boxes:

And how does the Javascript looks like?

function filterContactLookup(executionContext){

var formContext = executionContext.getFormContext(); // get the form context

if(formContext.getAttribute("new_orderid") != null) {

var orderField = formContext.getAttribute("new_orderid").getValue();
var orderFieldID = orderField[0].id;
var orderName = orderField[0].name;

formContext.getControl("new_contact").addPreSearch(function (){

    var fetchQuery = "<filter type='and'><condition attribute='new_orderid' operator='like' uiname='" + orderName + "' uitype='salesorder' value='" + orderFieldID + "' /></filter>";

    formContext.getControl("new_contact").addCustomFilter(fetchQuery);
});

        formContext.getControl("new_contact").removePreSearch(function(){

        var fetchQueryRemove = ""

        formContext.getControl("new_contact").addCustomFilter(fetchQueryRemove);

    });

}
}

This piece of code work fine when there are no special characters being used (for example the & character). And it happens quite often that the & character is being used in a name. I’ve tried all kinds of different options to fix this, like:

var fetchQuery = fetchQuery.replace(“&”, “&amp”);

fetchQuery = “?fetchQuery=” + encodeURIComponent(fetchQuery);

All different Xrm.Encoding options as noted on https://docs.microsoft.com/hr-hr/powerapps/developer/model-driven-apps/clientapi/reference/xrm-encoding but without success

and more options which works perfectly in C#….

Gladly for me there was a much easier option, and that was simply to remove the uiname from the fetchxml, and it kept working!

function filterContactLookup(executionContext){

var formContext = executionContext.getFormContext(); // get the form context

if(formContext.getAttribute("new_orderid") != null) {

var orderField = formContext.getAttribute("new_orderid").getValue();
var orderFieldID = orderField[0].id;
var orderName = orderField[0].name;

formContext.getControl("new_contact").addPreSearch(function (){

    var fetchQuery = "<filter type='and'><condition attribute='new_orderid' operator='like' uitype='salesorder' value='" + orderFieldID + "' /></filter>";

    formContext.getControl("new_contact").addCustomFilter(fetchQuery);
});

        formContext.getControl("new_contact").removePreSearch(function(){

        var fetchQueryRemove = ""

        formContext.getControl("new_contact").addCustomFilter(fetchQueryRemove);

    });

}
}

It took me a few hours to notice this…. So hopefully it will save you some time.

And please let me know if there are other options, for example when you don’t got the GUID and only the uiname.

5 Ways to Make Digital Transformation with Microsoft Dynamics 365 Actually Work (PART II)

By Bas Bergstra

In my previous blog about Digital Transformation (‘DT’) with Dynamics 365 initially the concept of DT was briefly explained by stating that it serves strategic objectives of our customers, which can be realized with support of Dynamics 365. Next, I emphasized that DT can be applied in a variety of ways. After this introduction my blog then zoomed into two ways of making DT with Dynamics 365 work. As the title suggests, it is now time to bring in three additional best practices.

The earlier discussed way number 2 for DT with Dynamics 365 regarded the importance having strong awareness of out-of-the-box features. On the other hand, it is crucial to have your semantics in place. Besides the point of that each industry or even organization is likely to have its own jargon; once having deciphered that, you may experience another haze. Often departments, teams or groups people commonly have different interpretations for the same concept. Another challenge is that you may assume familiarity of your counterpart with concepts such as Artificial Intelligence (‘AI’) and Robotic Process Automation (or ‘RPA’), but these are still not so mainstream as you might assume. Just imagine how long it took before the term ‘Internet’ was starting to resonate with your grandparents. So before introducing more advanced Dynamics 365 functionality such as Customer Insights and Lead Scoring Models, make sure to get your audience acquainted with the underlying concepts.

Finding out the DT maturity level of your customer is an effective route to determine appropriate timing of introducing Dynamics 365 features to them. This fourth way of making DT with Dynamics 365 work also relates back to the second challenge previously mentioned in this blog. The reason is that interpretation and timing often go hand in hand. Consider an example regarding a customer service manager who currently receives a weekly report on customer complaints expecting the same from the new Dynamics 365 solution.  After finding what he perceives as a ‘report’, you realize that his requirement could be met by simply providing access to of view of cases in Dynamics 365 Service. Do this instead of overwhelming him right away with Dynamics AI for Customer Service, thus time the pace of digitally transforming their processes to support customers. Remember, Rome was not built in a day either.

The last success factor for a Dynamics 365 implementation that I would like to share here regards user adoption. DT implies change and the willingness to adopt varies per user. Roughly spoken users can be grouped into three categories, i.e. 10% very open to change (referred to as pro-change opinion leader), 10% resistant to change (alias ‘con-change opinion leader’) and the opinion of the rest (80%) is likely to be affected by the opinion leaders. With tactical involvement of the group who is in favor, you are likely to win the majority also with your demonstration of added value with Dynamics 365. So, make sure to first focus on the pro-change opinion leaders and convert them into ambassadors or advocates inspiring the 80% group.

With these 5 ways you have a head start to leverage Dynamics 365 and transform your customer’s business. Please feel free to share your experiences, so I can start improving and or extend these ways in new posts.

Link to part I of this blog.

5 Ways to Make Digital Transformation with Microsoft Dynamics 365 Actually Work – Part I

By Bas Bergstra

Experienced with Microsoft Dynamics 365 implementations for some time now? Then you are probably also familiar with the term Digital Transformation. Even more so, chances are that if you have been working with Dynamics 365 for more than a few years, you probably already were helping transform the business of your customer before Digital Transformation became a buzz word.

Still, even though Dynamics 365 each year is well positioned in Gartner its Magic Quadrant for CRM and enjoying a steady growth of its user base, there are still many challenges to overcome when transforming organizations with that platform.

As a Consultant having worked with Dynamics 365 Customer Engagement (previously known as ‘CRM’) for many years now, I can totally relate to the challenges that we can run into.

Before zooming into the confrontations that might arise during your projects, let us break down the term Digital Transformation (‘DT’). The reason is that DT actually serves a goal, while technology such as Dynamics 365 is merely a mean to achieve the strategic objectives of our customers.

DT as a concept can be widely interpreted. Some organizations consider having a chatbot added to their website as a transformation in the way they provide service to customers, while others apply innovative technology to completely revolutionize business models in industries. Typical examples of disruptors such as Tesla, AirBNB and Uber have by now actually become a bit stale but are useful to illustrate the other side of the spectrum.

When looking at your typical project involving Dynamics 365 let us assume there is some degree of DT that your client is aiming for. Regardless to which extent ambitions are set, expectations regarding the level Dynamics 365 can meet then will be high. Especially when clients have completed a laborious RFI- and RFP process. The first challenge is then to manage their assumptions regarding the platform; this requires broad and detailed knowledge of the (latest) features.

Having completed the appropriate Microsoft certifications will certainly help a lot, even for the more seasoned consultants. This is contrary to a surprisingly common belief that learning theory only serves to successfully complete the exams. The actual benefit of certification is that it will trigger you to familiarize extensively with Out-of-the-Box features. For those of you who are still skeptical, the key is that preparing for an exam pushes you further and thereby encourages true commitment. Obvious reasons are the fact that you will then have a deadline to have completed your studying and the fact that Microsoft Learn is covering topics more extensively and effectively than ever before. In addition, checking YouTube offers tons of material, also listen to the relevant Pod casts to keep up.

With thorough knowledge of the Dynamics 365 features you might expect to be on pretty solid ground, when starting to engage with customers to determine a fit or gap for their requirements. And yes, as a starting point you are correct with that, but there is off course a ‘but’ leading to the second challenge. 

Customers typically do not express requirements for easy mapping to Dynamics 365. More often than not, specifications seem to demand for something different than what you learned when preparing for the Microsoft certifications. A common example is whether to map requirement for prospect management to the Out-of-the-Box entity Lead, Account or even Contact (in a Business-to-Consumer context).

Still, when having successfully completed the Dynamics 365 Sales exam you probably are able to effectively explain each feature and then together decide the adequateness accordingly. The key here is to consider standard functionality before entering the world of reinventing the wheel, by e.g. creating your own custom entity to manage a Prospect. A major drawback is that such entity will not leverage neat features such as seamless conversion of customer touch-points (i.e. activities such as e-mail or a web site visit) into a Lead for follow-up.

This concludes the first two ways to make DT with Dynamics 365 successful. Make sure to check my next blog with the more best-practices. Naturally I also highly value your feedback.

Link to part II of this blog.

Dynamics 365 – Security role Flow / Power Automate

By Ritchey Hazeu

You’ve build a Flow as an admin, deployed this flow to the next environment but none of your users are seeing this Flow.

Sound familiar? Read the following:

Besides activating Power Automate in your system settings (Settings -> Administration -> System Settings -> Customization -> Enable Microsoft Flow) there is also a privilege in the Security roles:

Navigate to one of your security roles and go to the Customization tab.

Below you will find “Run Flows”.

Dynamics 365 – How to reset the SharePoint integration button?

By Ritchey Hazeu

When you’ve got a server-based Sharepoint integration with Dynamics 365 you only see the “Enable Server-Based SharePoint Integration” button at the first time you are setting up the integration.

This looks like you can only set-up the integration only once, but in a rare situation you have to set it up again because of:

  1. You’ve got a new SharePoint environment;
  2. Your SharePoint Realm ID has changed.

You can return the integration button by deactivating your active SharePoint Sites by clicking on the below button and select your sites and deactivate them.

This will return your integration button and you can fill in a new SharePoint Realm ID.

Dynamics CRM/365 – Support lifecycle

By Ritchey Hazeu (Dynamics 365 Consultant @ Capgemini)

 

When you’re working for a customer which is using Dynamics CRM it’s always good to know if Microsoft still supports the current version. It depends on the Service Pack which ‘Support end date’ Microsoft applies.

For the older versions Microsoft applies 5 year Mainstream support and 5 year Extended support. Unfortunately this does not count for every Service pack. For Dynamics 365 it’s 5 year Mainstream support and 2 year Extended support.

An example: A customer is using Dynamics CRM 2016 Service Pack 1. This Service Pack has 23-05-2016 as start date and 08-01-2018 as end date. This means that, before the end date, an upgrade needs to be executed to Dynamics CRM 2016 Service Pack for Dynamics 365 (Service Pack 2).

If you want to know which End date is applied to your, or your customer’s Dynamics CRM solution, you can navigate to https://support.microsoft.com/en-us/lifecycle/search and type in the version.