One of the problems I faced in previous projects is, An agent is able to open the same case multiple times in the same session (wantedly/unwantedly), at later stages it creates lot of confusion. Recently I found couple of questions on MSDN forums as well on the same point, which made me to spend some time and dig in to a solution.
I must say, it is not a 100% full proof solution, but will definetly do a decent job. I will mention the “cons” with this solution at the end of this post and will provide alternates.
The Solution is “CaseManager”, a hosteed control which will monitor all the cases opening in the session and will keep a track of them based on the case id. For this, I have written peice of code (will push the source code in to Github and will share in saparate post) which I know majority of the USD lovers don’t like. But no worries, You don’t need to write the code – I have attached the required dlls, All you have to do is, copy the dlls in to USD installation folder (typically C:\Program Files\Microsoft Dynamics CRM USD\USD). Let’s go through Step by Step.
Step 1: Extract the Zip file, Copy the CaseManager.dll in to USD Installation folder.
Step 2: Create new Hosted control with following information
USD Component Type: USD Hosted Control
Application is Global: False (Unchecked)
Display Group: HiddenPanel
Application Is Dynamic: No
Assembly Uri: CaseManager
Assembly Type: CaseManager.ManageCases
Step 3: Create a new Action for this CaseManager
with name “CaseNavigationTriggered” by navigating into UII Actions of the Hosted control. Please note it is “Action” not an “Action call”. Only name is required, leave all other properties as is as shown below.
Step 4: Navigate to Window Navigation rules and open “Default Case” navigation rule.
This is the default navigation rule that will fire when any case is opened until unless any other navigation rule is defined against the source hosted control. Alter the navigation rule as mentioned & shown below.
Target Tab : (Clear existing value)
Show Tab : (Clear existing value)
Step 5: Create Action calls with the following details.
AC1: Manage Cases
AC2: CaseManager: Navigate Case
Name:CaseManager: Navigate Case
AC3: CaseManager: Case already opened error
Name:CaseManager: Case already opened error
Hosted Control:Crm Global Manager
Lastly to set the focus on to the case tab (if we navigate), attach the existing “Show Tab for Case” action call to Second action call ie. AC2: CaseManager: Navigate Case as sub action. If you didn’t find one in your configurations, create the same with the help of below image.
Step 6: The last one. Add all the 3 action calls to the window navigation rule as shown below.
Thats it, Now you should be able to see the following error message in USD whenever you open the same case again.
Btw, I thought it is a good to allow to open multiple “NEW” cases, so I haven’t placed any restrictions for new cases .
Now, lets have a quick talk about the limitations of it.
a) Open a new case, Save it. Then try to open the same case again from some other place in the same session (like from associated cases grid). This scenario is not handled and I need bit more time to gracefully handle these kind of “wantedly doing” scenarios.
b) Open a case, Close it some how (close the tab) and try to open the case again. System will show the error message. I will try to handle it in next release and will do a continution post. However, the OOB configurations of case will not allow you to close the tab directly (there is no “X” button to close), so I think this can be considered partially handled .
These are the 2 scenarios, I can see are failing. Please comment if you have any other scenarios.
The Case Manager dll is available at (attachment) : https://drive.google.com/file/d/0BxR-ns-wP3gLeTZuRjd4VDE3TW8/view?usp=sharing
Hope this helps, All the very best !!