Share via


Microsoft Dynamics 365 Troubleshooting: Unified Service Desk

This article contains information about the issues that you might encounter while using Unified Service Desk for Microsoft Dynamics 365, and how to resolve them. The article will be continuously updated as we discover more issues or resolve the existing issues in the future version of Unified Service Desk.

 

 

Note

This article is closely monitored. Any changes made to this article by others will be evaluated, and then quickly accepted, refined, or reverted.

Because this is a wiki, additions or refinements to this article might have been made by community members. To read the "last official" version of the article, click here.

 


Focus jumps out randomly on adjacent application tabs in Unified Service Desk

Issue

Hosted controls configured using the IE Process hosting mode might experience random focus issues. This can be seen as focus jumping to adjacent application tabs when user clicks on Menu/Sub-Menu buttons.

Cause

When hosted controls are hosted using the IE Process mode, under the cover it's an Internet Explorer process that is hosted within the Unified Service Desk shell. The Internet Explorer process steals focus from the Unified Service Desk shell, which causes the observed behavior.

Resolution/Workaround

The Unified Service Desk team is working on a resolution for this issue. Until then, you can use the following workaround:

  1. Create a Windows Class Library project in Visual Studio. Specify the name of the project as USDExternal.

  2. Add references to the following Unified Service Desk assemblies in your project: Microsoft.Crm.UnifiedServiceDesk.BaseControl.dll, Microsoft.Crm.UnifiedServiceDesk.CommonUtility.dll, Microsoft.Crm.UnifiedServiceDesk.Dynamics.dll, Microsoft.Uii.AifServices.dll, Microsoft.Uii.Csr.Core.dll, Microsoft.Uii.Desktop.UI.Controls.dll, and Microsoft.Xrm.Tooling.Connector.dll. These assemblies are available in the Unified Service Desk Client installation directory, typically C:\Program Files\Microsoft Dynamics CRM USD\USD.

  3. Add references to the following Framework assemblies: PresentationCore.dll, PresentationFramework.dll, System.Xaml.dll, and WindowsBase.dll.

  4. Open the Class1.cs file, and replace the existing code with the following code:

    using  System;
    using System.Globalization;
    using  System.Windows;
    using System.Windows.Input;
    using  Microsoft.Crm.UnifiedServiceDesk.BaseControl;
    using Microsoft.Crm.UnifiedServiceDesk.Dynamics;
    using  Microsoft.Uii.AifServices;
    using Microsoft.Uii.Desktop.UI.Controls;
     
    namespace USDExternal
    {
     /// <summary>
     /// Retains the focus on USD when IE hosting mode hosted controls are configured
     /// </summary>
     public class  FocusManagerHostedControl : DynamicsBaseHostedControl
     {
     #region Vars
     /// <summary>
     /// This should correspond to the name of the PanelLayout hosted control defined in the configuration. 
     /// </summary>
     private const  string strMainPanel = "Main Layout/MainPanel";
     //Custom Layout/MainPanel
     
     #endregion
     
     /// <summary>
     /// UII Constructor 
     /// </summary>
     /// <param name="appID">ID of the application</param>
     /// <param name="appName">Name of the application</param>
     /// <param name="initString">Initializing XML for the application</param>
     public FocusManagerHostedControl(Guid appID, string appName, string initString)
     : base(appID, appName, initString)
     {
     
     }
     
     
     /// <summary>
     /// Raised when an action is sent to this control
     /// </summary>
     /// <param name="args">args for the action</param>
     protected override  void DoAction(Microsoft.Uii.Csr.RequestActionEventArgs args)
     {
     // Log process.
     DynamicsLogger.Logger.Log(string.Format(CultureInfo.CurrentCulture, "{0} -- DoAction called for action: {1}", this.ApplicationName, args.Action), System.Diagnostics.TraceEventType.Information);
     try
     {
     if (args.Action.ToLower() == "default")
     {
     IDesktopFeatureAccess desktopFeatureAccess = null;
     if (AifServiceContainer.Instance.GetService<IDesktopFeatureAccess>() != null)
     desktopFeatureAccess = AifServiceContainer.Instance.GetService<IDesktopFeatureAccess>();
     
     IPanel mainPanel = null;
     if (desktopFeatureAccess != null)
     mainPanel = desktopFeatureAccess.GetPanel(strMainPanel);
     
     if (mainPanel != null)
     mainPanel.SelectedAppChanged += MainPanel_SelectedAppChanged;
     }
     }
     catch (Exception ex)
     {
     DynamicsLogger.Logger.Log(this.ApplicationName + "Error in :DoAction() \r\n "  + ex.Message + "\r\n"  + ex.StackTrace);
     }
     base.DoAction(args);
     }
     
     /// <summary>
     /// Event is fired when a TabConrol.SelectedIndexChanged event is fired. 
     /// </summary>
     /// <param name="sender"></param>
     /// <param name="e"></param>
     void MainPanel_SelectedAppChanged(object sender, EventArgs e)
     {
     try
     {
     FrameworkElement focussedApp = Application.Current.MainWindow;
     if (focussedApp == null) return;
     DependencyObject focusScope = FocusManager.GetFocusScope(focussedApp);
     FocusManager.SetFocusedElement(focusScope, focussedApp);
     }
     catch (Exception ex)
     {
     DynamicsLogger.Logger.Log(this.ApplicationName + "Error in : mainPanel_SelectedAppChanged() \r\n " + ex.Message + "\r\n" + ex.StackTrace);
     }
     }
     }
    }
    
  5. Build the Visual Studio project. This will generate a USDExternal.dll file in the Debug folder of your Visual Studio project directory.

  6. Copy the USDExternal.dll file to your Unified Service Desk client installation directory, typically C:\Program Files\Microsoft Dynamics CRM USD\USD.

  7. In your CRM instance, create a hosted control called FocusManager in Unified Service Desk with the following definition to use the custom code you created in previous steps:

  8. Configure an action call, ActionCall to Focus On Active App, on the new hosted control as shown below:

  9. Navigate to Events, and add the action call configured in the previous step to the DesktopReady event for the CRM Global Manager hosted control. Adding this action call to any other event isn't recommended as it may degrade the Unified Service Desk performance.

Run the Unified Service Desk client, and connect to your CRM instance. The focus issue should be resolved.

 



Data parameters not refreshing for hosted controls configured with AllowMultiplePages = True

Issue

When using hosted controls configured using the IE Process hosting mode and AllowMultiplePages = True, the data parameter is not refreshed when user switches between apps using the drop-down in a tab.

Cause

The selected app changed event of the drop-down is not programmed to update the data context.

Resolution/Workaround:

Use the following approach to resolve this issue.

  1. Create a Windows Class Library project in Visual Studio. Specify a name of the project (lets say USDExternal).

  2. Add references to the following Unified Service Desk assemblies in your project: Microsoft.Crm.UnifiedServiceDesk.BaseControl.dll, Microsoft.Crm.UnifiedServiceDesk.CommonUtility.dll, Microsoft.Crm.UnifiedServiceDesk.Dynamics.dll, Microsoft.Uii.AifServices.dll, Microsoft.Uii.Csr.Core.dll, Microsoft.Uii.Desktop.UI.Controls.dll, and Microsoft.Xrm.Tooling.Connector.dll. These assemblies are available in the Unified Service Desk Client installation directory, typically C:\Program Files\Microsoft Dynamics CRM USD\USD.

  3. Add references to the following Framework assemblies: PresentationCore.dll, PresentationFramework.dll, System.Xaml.dll, and WindowsBase.dll.

  4. Open the Class1.cs file, and replace the existing code with the following code:

    using  System;
    using System.Collections.Generic;
    using  System.Globalization;
    using System.Windows;
    using  System.Windows.Controls;
    using System.Windows.Input;
    using  System.Windows.Media;
    using Microsoft.Crm.UnifiedServiceDesk.BaseControl;
    using  Microsoft.Crm.UnifiedServiceDesk.CommonUtility;
    using Microsoft.Crm.UnifiedServiceDesk.Dynamics;
    using  Microsoft.Crm.UnifiedServiceDesk.Dynamics.Controls;
    using Microsoft.Crm.UnifiedServiceDesk.Dynamics.PanelLayouts;
    using  Microsoft.Uii.AifServices;
    using Microsoft.Uii.Csr;
    using  Microsoft.Uii.Desktop.UI.Controls;
     
     
    namespace UsdExternal
    {
     /// <summary>
     /// Listenes for selected app changed event raised by hosted controls where allowmultiplepages=true
     /// </summary>
     public class  SelectedApptChangedEventListener : DynamicsBaseHostedControl
     {
     #region Vars
     /// <summary>
     /// This should correspond to the name of the PanelLayout hosted control defined in the configuration. 
     /// </summary>
     private const  string strMainPanel = "Main Layout/MainPanel";
     //Main Layout/MainPanel
     //Custom Layout/MainPanel
     
     #endregion
     
     /// <summary>
     /// UII Constructor 
     /// </summary>
     /// <param name="appID">ID of the application</param>
     /// <param name="appName">Name of the application</param>
     /// <param name="initString">Initializing XML for the application</param>
     public SelectedApptChangedEventListener(Guid appID, string appName, string initString)
     : base(appID, appName, initString)
     {
     
     }
     
     
     /// <summary>
     /// Raised when an action is sent to this control
     /// </summary>
     /// <param name="args">args for the action</param>
     protected override  void DoAction(Microsoft.Uii.Csr.RequestActionEventArgs args)
     {
     // Log process.
     DynamicsLogger.Logger.Log(string.Format(CultureInfo.CurrentCulture, "{0} -- DoAction called for action: {1}", this.ApplicationName, args.Action), System.Diagnostics.TraceEventType.Information);
     try
     {
     if (args.Action.ToLower() == "default")
     {
     IDesktopFeatureAccess desktopFeatureAccess = null;
     if (AifServiceContainer.Instance.GetService<IDesktopFeatureAccess>() != null)
     desktopFeatureAccess = AifServiceContainer.Instance.GetService<IDesktopFeatureAccess>();
     
     //Get the main panel matching the name defined in the configuartion
     IPanel mainPanel = null;
     if (desktopFeatureAccess != null)
     mainPanel = desktopFeatureAccess.GetPanel(strMainPanel);
     
     if (mainPanel != null)
     {
     //Get the TabControl referenct
     TabControl control = mainPanel as  TabControl;
     if (control != null) //Subscribe to the SelectionChanged event of the tab control hosted within the MainPanel. this will be the one hosting the Multiple pages dropdown within it.
     control.SelectionChanged += control_SelectionChanged;
     else
     DynamicsLogger.Logger.Log(string.Format(CultureInfo.CurrentCulture, "Listening to SelectionChanged failed "),
     System.Diagnostics.TraceEventType.Information);
     }
     else
     DynamicsLogger.Logger.Log(string.Format(CultureInfo.CurrentCulture, "Panel {0} not found", strMainPanel, args.Action), System.Diagnostics.TraceEventType.Information);
     }
     }
     catch (Exception ex)
     {
     DynamicsLogger.Logger.Log(this.ApplicationName + "Error in :DoAction() \r\n "  + ex.Message + "\r\n"  + ex.StackTrace);
     }
     base.DoAction(args);
     }
     
     void control_SelectionChanged(object sender, SelectionChangedEventArgs e)
     {
     //this will filter the noise and only listen to events raised for MultiplePages dropdown. 
     //DO NOT ALTER THIS
     if (e.AddedItems.Count == 1 && e.RemovedItems.Count == 1 && e.AddedItems[0] is  PresenterControlComboBoxItem && e.RemovedItems[0] is PresenterControlComboBoxItem)
     {
     // add your code to call ScanForDataParameters here
     }
     }
     }
    }
    
  5. Build the Visual Studio project. This will generate a USDExternal.dll file in the Debug folder of your Visual Studio project directory.

  6. Copy the USDExternal.dll file to your Unified Service Desk client installation directory, typically C:\Program Files\Microsoft Dynamics CRM USD\USD.

  7. In your CRM instance, create a hosted control called SelectedAppChangedEventListener in Unified Service Desk with the following definition to use the custom code you created in previous steps:

  8. Configure an action call, Action call to Initialize SelectedAppChangedEventListener, on the new hosted control as shown below:

  9. Navigate to Events, and add the action call configured in the previous step to the DesktopReady event for the CRM Global Manager hosted control. Adding this action call to any other event isn't recommended as it may degrade the Unified Service Desk performance.

Run the Unified Service Desk client, and connect to your CRM instance. The issue should be resolved.


See Also