Skip to main content

XrmToolBox: AutoNumberUpdater - new StateCode filter

Application was unable to connect to the external server

One of our customers approached us with the following issue they had with the Field Service app provided by Microsoft’s Store.
clip_image001
The customer has an on-premise CRM installation. Therefore the app is required to access the CRM server via ADFS in the company’s local area network.
The simplified architecture looks equal to this one:
clip_image001[5]
After some time of investigation I was able to repreduce this issue with the native Resco Mobile CRM app installed via Microsoft Store with Windows 10 as well.
Whenever the machine had an internet connection the app worked just fine, but as soon as the app was launched in a local area network only without any internet connection, the app complained with the error box shown above.
Second step was to use Fiddler tracing as described here:
https://www.resco.net/fiddler-trace/
With an active internet connection I found appropriate Fiddler logs with connection requests. Interestingly, without internet connection I could not find any requests at all.
This gave me the right pointer that this is a application driven behavior and that the issue must be in the coding.
I opened a ticket with Resco support and they kindly provided me the method they use to identify an active connection in their UWP (Universal Windows Plattform) app as well as in their desktop app.
The suspicious method is:
NetworkInterface.GetIsNetworkAvailable()
https://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getisnetworkavailable(v=vs.110).aspx
Now I created two test apps, one UPW app and one regular Windows console app in Visual Studio.
I used GetIsNetworkAvailable() method in both apps and cut off any active internet connection from my test environment. Then I tried to connect to a locally hosted CRM server in our local area network.
The UWP app threw a similar exception as above whereas the console app was fully satisfied with the LAN connection.
I analysed the implementation of the GetIsNetworkAvailable method of the Universal Windows Apps.
Decompiling the System.Net.Networking.dll I found this implementation:
clip_image002
The Enum NetworkConnectivityLevel also contains „LocalAccess“.
https://docs.microsoft.com/en-us/uwp/api/windows.networking.connectivity.networkconnectivitylevel
This means in the world of UW Windows (Store) apps at this point the method GetIsNetworkAvailable() is not usable within a restricted company network.
This will make both your Resco Mobil CRM and also the MS Field Service app not usable in a company network that has the status „LocalAccess“.
Now that I knew the reason behind this problem I was able to provide the customer with a workaround described in these blogs:
https://blogs.msdn.microsoft.com/canberrapfe/2012/10/09/fake-internet-connectivity-for-your-lab-tricking-ncsi/
https://www.chrisebner.de/microsoft/windows-allgemein/network-connectivity-status-indicator-ncsi/
The customer installed a local NCSI server and pointed the desktop PC via changed registry entries to this new server which at the end made the machine think it has an active internet connection.
With that the Field Service app was usable now.
Parallel to this workaround Resco was so nice to accept my code-based workaround that they later had implemented in their UWP code base to deal with LAN networks in a better way which also enables the app to work in LAN networks:
    ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();
    NetworkConnectivityLevel connection = InternetConnectionProfile.GetNetworkConnectivityLevel();
     switch (connection)
     {
          case NetworkConnectivityLevel.None:
                // return has no connection
          case NetworkConnectivityLevel.LocalAccess:
          case NetworkConnectivityLevel.ConstrainedInternetAccess:
          case NetworkConnectivityLevel.InternetAccess :
                // return has a connection
     }
Since Resco Mobile CRM version 11.0.1.0 this problem is gone and was able to verify this successfully with my customer.

Comments

Popular posts from this blog

Yet Another Address Autocomplete PCF Control–powered by Bing

In this blog post I will not go into detail in how to install all the pre-requisites that are required to build and run PCF controls. My goal was to build a new PCF control and get into coding of PCF controls as fast as possible. Here are a few links to articles that will help you installing the pre-requisites (Microsoft PowerApps CLI)  https://docs.microsoft.com/en-us/powerapps/developer/component-framework/get-powerapps-cli Other good references to get into this topic: https://toddbaginski.com/blog/how-to-create-a-powerapps-pcf-control/ https://docs.microsoft.com/en-us/powerapps/developer/component-framework/create-custom-controls-using-pcf I looked through the Guido Preite’s https://pcf.gallery/ which will help you find appropriate use cases / examples for your own needs. It did not take very long to find a simple example to start with: Andrew Butenko's https://pcf.gallery/address-autocomplete/ A few moments later I had the idea to create yet another address autocomplete...

Regarding SPFieldMultiLineText (Add HTML/URL content to a field) programmatically

I recently tried so set some HTML content in a SharePoint list column of type SPFieldMultiLineText. My first approach was this piece of code: SPFieldMultiLineText field = item.Fields.GetFieldByInternalName( "Associated Documents" ) as SPFieldMultiLineText; StringBuilder docList = new StringBuilder(); docList.Append( " " ); foreach (DataRow docRow in addDocs) { DataRow[] parent = dr.Table.DataSet.Tables[0].Select( "DOK_ID=" + docRow[ "DOK_MGD_ID" ].ToString()); if (parent != null && parent.Length > 0) { docList.AppendFormat( " {1} " , parent[0][ "FilePath" ].ToString(), parent[0][ "Title" ].ToString()); } } if (docList.Length > 0) { // remove trailing tag docList.Remove(docList.Length-5, 5); } docList.Append( " " ); string newValue = docList.ToString(); item[field.Title] = newValue; What this code does is to get all associated documents to the main document and to add these docu...

CRM 2016 SP1: Solution import failed with Solution With Id = 12ac16ec-41d5-1685-a230-0b1c31499250 Does Not Exist

Importing Solutions with the upgrade solution (holding solution) option is still not stable with CRM 2016 SP1 On-Premise. Ronald Lemmon already posted the same issue on his blog: http://ronaldlemmen.blogspot.de/2015/11/solution-with-id-86ac16ec-41d7-4685.html I expected it to be fixed with SP1 but it is still happening every now and then. With this query and the solution id (guid) of the error message you are able to find records in the ProcessTriggerBase table that reference the guid of a failed import from a holding solution that is not existing in the system anymore. select * from ProcessTriggerBase where solutionid = 'YOUR_SOLUTION_GUID' Due to this reference to a solution id not existing in the system you will not be able to import a new version of the target solution to be updated. What I did and this is probably not a supported solution is to update the guid to the actual target solution that is currently deployed in the system. To find out the id of ...