Tip #810: Using Fiddler with Xrm Tooling

Sometimes it’s very useful to see what requests are flying forth and back between your code and Dynamics 365. The tool of trade is, of course, Fiddler. Fiddler allows https traffic analysis by using man-in-the-middle interception using self-signed certificates.

If you are using Xrm Tooling and, specifically, CrmServiceClient then you quickly find that the following code:

var s = 
 @"Url=https://a.crm.dynamics.com;AuthType=Office365;
   UserName=foo@a.onmicrosoft.com;Password=strongone";

using (var crmSvc = new CrmServiceClient(s))
{
   Console.WriteLine($"{crmSvc.IsReady}");
   if(crmSvc.IsReady) 
   {
      Console.WriteLine(
      $"{crmSvc.ConnectedOrgFriendlyName}");
   }
   else 
   {
      Console.WriteLine("Doh!");
   }
}

generates a friendly “Doh!” instead of a friendly organization name.
The logs will show the following error: The remote certificate is invalid according to the validation procedure, and it’s fair enough as Fiddler certificates are self-signed.

If you do want that trace, there is a silver bullet and a brilliantly concise gun to fire it. Just add the following code before creating CrmServiceClient:

ServicePointManager
   .ServerCertificateValidationCallback +=
   (sender, cert, chain, sslPolicyErrors) => true;

Happy debugging!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #809: When You Can’t Remove Project Service

Say you installed the PSA solution in your sandbox environment, and you decided that you aren’t quite ready for it, so you want to remove it. However, when you try to uninstall the solution, the process fails, but the log gives you no indication about what is causing the conflict.

This was where we found ourselves recently. Thanks to some help from Microsoft support, we were able to find the problem.

It turns out that when the system was configured, a global option set was used for birthday day that was actually part of the Project Service solution. This dependency kept the solution from uninstalling. Once the option set was changed to another custom global option set, the solution uninstalled without issue.

Lesson learned: check your global option sets, as they may not show in the dependency list when uninstalling solutions.

Thanks to Jerry Martin for his second tip suggestion.

 

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #808: Tracing with Xrm Tooling in Azure Functions

By now you should be able to get your Azure Function triggered from Dynamics 365 and connect back to Dynamics 365 to do some evil awesome things. Debugging Azure Functions however, is not a walk in a park – not like you can set breakpoints and step through the code.

Well, you should, of course, write some nice classes doing the job, test them using test harness or, at very least, a simple console application and then refer to those classes in your Azure Function code.

If something goes wrong in production and you need to get to the bottom of it, all Azure Functions entry points provide TraceWriter that you can use to dump the information required. That’s in your code but what about mysterious internals of Xrm Tooling black box? What if your code cannot connect to Dynamics 365 instance?

TraceWriter is an abstract class implemented in Azure WebJobs SDK while Xrm Tooling utilizes System.Diagnostics Debug/Trace/TraceListener model.

Create additional file ToolingListener.csx

using System;
using System.Diagnostics;

// Log writter for working with Azure Functions 
// for the Xrm.Tooling.Connector
public class Toolinglistener : TraceListener
{
  private TraceWriter _log;

  public Toolinglistener(string name, 
            TraceWriter logger) : base(name)
  {
    _log = logger;
  }

  public override void Write(string message)
  {
    _log?.Info(message);
  }

  public override void WriteLine(
            string message)
  {
    _log?.Info(message);
  }
}

Then add the following to the original function:

#load "ToolingListener.csx"

using System;
using System.Diagnostics;
using Microsoft.Xrm.Tooling.Connector;

public static void Run(string input, TraceWriter log)
{
    TraceControlSettings.TraceLevel = SourceLevels.All;
    TraceControlSettings.AddTraceListener(
		new ToolingListener(
			"Microsoft.Xrm.Tooling.CrmConnectControl", 
			log));

And you should see very detailed output in your function log:


Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : Using User Specified Server
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : Trying Live Discovery Server, (North America) URI is = https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Start: 256 : QueryLiveDiscoveryServer()
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : DiscoverOrganizations - Initializing Discovery Server Object with https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : DiscoverOrganizations - attempting to connect to CRM server @ https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : DiscoverOrganizations - created CRM server proxy configuration for https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc - duration: 00:00:11.1699811
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : DiscoverOrganizations - proxy requiring authentication type : OnlineFederation
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : DiscoverOrganizations - Authenticated via OnlineFederation. Auth Elapsed:00:00:03.2299574
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : DiscoverOrganizations - service proxy created - total create duration: 00:00:14.4031174
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : DiscoverOrganizations - Discovery Server Get Orgs Call Complete - Elapsed:00:00:15.9204376
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : Found 1 Org(s)
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Start: 256 : BuildOrgConnectUri CoreClass ()
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : DiscoveryServer indicated organization service location = https://foobar.api.crm.dynamics.com/XRMServices/2011/Organization.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Stop: 512 : BuildOrgConnectUri CoreClass ()
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : Organization Service URI is = https://foobar.api.crm.dynamics.com/XRMServices/2011/Organization.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : ConnectAndInitCrmOrgService - Initializing Organization Service Object
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : ConnectAndInitCrmOrgService - Requesting connection to Org with CRM Version: 8.2.0.764
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : ConnectAndInitCrmOrgService - Using ISerivceManagement
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : ConnectAndInitCrmOrgService - attempting to connect to CRM server @ https://foobar.api.crm.dynamics.com/XRMServices/2011/Organization.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : ConnectAndInitCrmOrgService - created CRM server proxy configuration for https://foobar.api.crm.dynamics.com/XRMServices/2011/Organization.svc - duration: 00:00:37.6740783
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : ConnectAndInitCrmOrgService - proxy requiring authentication type : OnlineFederation
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : ConnectAndInitCrmOrgService - Authenticated via OnlineFederation. Auth Elapsed:00:00:00.5627215
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : ConnectAndInitCrmOrgService - service proxy created - total create duration: 00:00:38.2390845
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : ConnectAndInitCrmOrgService - Proxy created, total elapsed time: 00:00:38.2410960
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : User Org (org358a83d1) found in Discovery Server NorthAmerica - ONLY ORG FOUND
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : Beginning Validation of CRM Connection
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Information: 8 : Validation of CRM Connection Complete, total duration: 00:00:08.3293161
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : New Batch Manager Created, Max #of Batches:50000, Max #of RequestsPerBatch:5000

Of course, the code takes a shortcut with log.Info and requires a bit of tuning like mapping logging levels from Connector to TraceWriter but those are the details we can live without, right?

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #807: Data refresh in Power BI using old endpoint fails

Today’s tip is from our almost regular Matt Johnson.

I was recently tasked with creating a Power BI dashboard based directly off the CRM (sorry, I mean Dynamics 365) data. We were in a bit of a rush and even though the performance isn’t great we only needed a few charts and it was only a POC. Using Power BI Desktop you can add a datasource and select Dynamics 365 form the list.

Power BI Get Data

Then it prompts you for the OData service (notice the format it is asking for)

Power BI URL Prompt

So you fill in your org as prompted, connect up as a user and away you go. You can build you dashboards/reports/datasets and refresh them to your hearts content.

Then when publish your report to the online Power BI service, it allows you to do it no problem. However, if you then try and refresh your dataset, you get an error,

Your data source can’t be refreshed because the credentials are invalid. Please update your credentials and try again.

Power BI Invalid Credentials

OK you might say, I’ll re-enter my credentials. So you change the Authentication Method from the default Anonymous to OAuth2 but you still get the error.

Power BI failed to update

After much searching I came across this TechNet article where it tells you that you must use the new web api in the format https://foo.api.crm.dynamics.com/api/data/v8.1 to connect to your org in PowerBI Desktop. Even though it prompts you for the older SOAP endpoints in the format https://bar.crm4.dynamics.com/XRMServices/2011/OrganizationData.svc.

Using the new web api allows you to get at all your data and publish the reports out to PowerBI online and then you can successfully connect and refresh your data.

Power BI Successfull Refresh
Power BI Successfull Connect using OAuth2

Thanks, Matt for the tip, as you said yourself – maybe it will save someone a lot of messing about!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #806: How to display portal version

The break was short-lived! Without further ado, first tip of 2017.

If you navigate to your Dynamics 365 Administration Center and display all solutions installed in your organization, you will be able to see the version of the solution(s) installed but not the version of the portal code itself.

Just add /_services/about to your portal url:

Portal version

In addition to the version, you’ll see a guid that identifies the portal product id within your O365 tenant. Both pieces of information would come handy when raising support requests for any issues related to your Dynamics 365 Portal.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #805: You don’t need these tips

Carpet cleaningThis post is the final tip of 2016, with tipsters taking a break to spend their time elsewhere. It’s been a busy year, with many changes to our beloved Dynamics CRM 365 platform over the past year, and like with your closet and the clothes that no longer fit you, it is time to clean out some of our tips that no longer fit.

The following are some of the tips from the past that you can now ignore:

Tip #11: make IE 11 not open the mobile express page. It doesn’t do that anymore.

Tip #41 : compare CRM and SalesForce pricing. The point of the diagram is still true, but with Dynamics 365 we would need more lines because there are a lot more options now.

Tip #50 : auto-enable content in exported documents and spreadsheets. The modern Excel export and document generation capabilities no longer disable the exported document.

Tip #52: open a second Outlook window. Why in the world would you want to do this? This tip should have been called “how to make your computer run miserably slow and die painfully. Get the new Outlook App for Dynamics 365 already.

Tip #67: Get to advanced find from any view. While this is still accurate, now that Microsoft came to their senses and put the Advanced Find button in the prominent location at the top of the form, this is no longer the best way to get there.

Tip #68: Do you know this woman? No, I haven’t seen her for years.

Tip #71: Option sets getting cut off at the bottom of forms. It doesn’t do that anymore.

Tip #84 : Issues caused by lack of true date-only fields. Now that we have real date only field options, this tip is unnecessary.

Tip #88: Duplicate activities created due to reassigning during create. This doesn’t happen anymore.

Tip #101:Can you translate this please? The tips says that there are 41 languages available. At last count, there are 45 language packs for Dynamics 365 now available.

Tip #102: Replace the first things first woman. Ok, now I remember her, and judging from the photos in this post, we had some really good times together. You can make this post relevant again by embedding her photo into a Dynamics 365 Learning Path.

Tip #103 : Email router needs updating after moving to Office 365. By now, every company that uses CRM Online/Dynamics 365 is on Dynamics 365, and what are you doing still running the email router?

Tip #104: Bulk track emails. If you organize your emails with subfolders, save yourself a step in this process and add some folder tracking rules.

Tip #109: Manage documents from mobile. With server-side SharePoint integration, documents now work from mobile via the Dynamics 365 mobile app.

Now that we have cleaned out the back closet, we have room for another year of tips. Here’s to seeing how Microsoft will prove us wrong in 2017. See you then!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #804: Video Guide to Dynamics 365 SiteMap Editor

Sitemap with treasureIn this video we look at the new Dynamics 365 built-in Site Map editor that is part of Dynamics 365’s App Designer. We talk about the different ways to access the designer, and how to use it to edit an Application Site Map.

Give us your feedback, all of it: good, bad, and ugly, I’m sure we can take it. Suggest new topics either in comments or by sending your ideas to jar@crmtipoftheday.com.

Don’t forget to subscribe to http://youtube.com/crmtipoftheday!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #803: Troubleshooting form scripts in mobile

If you have deployed CRM mobile apps for phones or tablets, you may have found that sometimes form scripts that work in browser on a PC do not work in mobile, or the mobile app gives you an error message that you don’t see in the browser on your computer. This can be frustrating as mobile devices don’t have the robust debugging tools that PC browsers do.

Guest tipster Jerry Martin alerted us to a way that you can troubleshoot script errors in the mobile app:

  1. Add the debugger statement to your script.
  2. As we shared way back in tip 127, open the mobile app UI in your PC browser.
  3. Use your developer tool of choice to debug and troubleshoot the script.

Alternatively, you could use the new form customization mobile preview; however, if your script depends on data being there, the in-browser mobile URL is a better choice. The SDK suggests that if you are using Windows 10 and have Visual Studio installed, you can install the Windows version of the Dynamics 365 mobile app and use Visual Studio to debug your scripts.

Do you think that Relationship Insights is the top Dynamics news of 2016? Vote now for the top Dynamics new story of the year, then tune in to CRM Audio to hear the results next week for our year in review episode.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #802: PowerApps vs Dynamics 365

I have a scenario for a line of business application. Should I use Dynamics 365, or should I build a Power App?

This is a question that a growing number of companies are asking. The marketing message around PowerApps is very similar to the xrm message–build powerful line of business applications without having to worry about the “plumbing” (security, authentication, data model) and with minimal custom development. 

 When approaching this question, I would first look at what business problem you are trying to solve. If you are doing anything like sales opportunity management, customer service, field service, Dynamics is a better place to start because it has rich and mature functionality in these areas that would be very difficult to duplicate with a PowerApp, along with the infrastructure to handle complex security requirements.

But if you are looking to just build a simple focused business mobile app, PowerApps are a good option. And Dynamics and PowerApps are not mutually exclusive, since Dynamics can be a data source for a PowerApp. PowerApps are also a great home when there are needs for mashup experiences where CRM and other systems come in one app.

If you want full Dynamics functionality on a mobile device, the best choice is probably going to be Dynamics 365 mobile apps. If you want a more limited focus mobile app that includes Dynamics data but also includes data and functionality from other sources, PowerApps may be a better choice. And the right answer may well be “both.”

To access Dynamics data from PowerApps, users have to be licensed for Dynamics, so users will have access to both applications.

Thanks to Nikita Polyakov for contributing to this tip!

Do you think that Field Service is the top Dynamics news of 2016? Vote now for the top Dynamics new story of the year, then tune in to CRM Audio to hear the results next week for our year in review episode.

Back
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+

Tip #801: How to get Dynamics 365 now

So you licensed Dynamics CRM Online prior to the November release of Dynamics 365, and you want to go to Dynamics 365 now, without waiting for the upgrades to happen in January (and you haven’t really done much configuration in your environment).

Here’s how you can have that Dynamics 365 goodness right now:

  1. Go to the instance selector and select your sandbox organization and click the “reset” button.

reset1

2. Select “Dynamics 365” as the target version and reset your organization.

reset2

Your sandbox will be wiped out and replaced with a brand new shiny Dynamics 365 organization. Note this will do away with any data or configuration you may have in your environment. If you want to keep what you have, you will need to schedule your upgrade.

But what about production environments? I don’t see the reset option.

Production environments do not have the same reset and restore options as sandbox environments do. This is to protect you from yourself accidentally wiping out your production environment. However, you can change the organization type on your production organization to sandbox, reset it, and then set it back to production.

Do you think that online backup and restore is the top Dynamics news of 2016? Vote now for the top Dynamics new story of the year, then tune in to CRM Audio to hear the results next week for our year in review episode.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Tweet about this on TwitterShare on FacebookShare on Google+