This week I gave a presentation in Dublin about Microsoft’s Unified Service Desk (USD) for Dynamics 365. At the end of the presentation I was asked a great question about how to automatically pop the next phone call for an agent making a list of outbound calls. I love great USD questions! So during my flight home I started to design a solution to this problem. In this post I will document the approach I’ve now implemented.
![]()
I already had a tab called “My Work”. In this I display lists of items that need to be worked on. Such as “My Phone Calls” or “My Cases” etc. Operators should ideally open the first item in the list and once completed progress to the next. Initially in my application this involved the operator repeatedly selecting the top item.
But what I now wanted to implement was a “batch” approach, when the first phone call in the list would be presented to the operator. And once that phone call was closed the next phone call would load and so on. Until either the agent decides to stop making calls or the list is complete. This problem presented me with several challenges, firstly how to repeatedly get the first item from the list. And secondly how to load the selected record. (This was actually the easy bit!) Next I needed to give the operator an easy way to exit the batch mode. As otherwise they’d be stuck in an endless loop and never be able to take a break!
This is not a simple USD change! I am going to assume you already have a good understanding of how USD works, sorry. But to aid my explanation of how this change operates I have created a short demo video. Hopefully seeing this may give you ideas on how to adapt / improve this for your own applications! My intention here is to provide some guidelines on how you might use entity searches to automate the process of making outbound phone calls. (But the same concept could be adapted for any list of “work” that need to be processed, For example, maybe you could adapt this idea for agents who have lists of cases to action!)
Important Note: As already mentioned I already have a tab called “My Work”. In this tab I show a view of “My Phone” calls. Clicking on a phone call will open it in a session. I am not going to explain how to create that functionality in this post! I am therefore assuming that you can already open phone calls manually one by one. (This means I already have the required window navigation rules to open phone call sessions, load the required agent script etc.)
The parts of my solution include;
- Entity Search
-
Actions
- Action One – Do Search for next phone call
- Action Two – Pop phone call found with search
- Action Three – Display message when batch is complete
- Action Four – Set Batch Mode, False
- Action Five – Set Batch Mode, True
- Action Six – Refresh my work tab
- Action Seven – Close My Work Tab
-
Toolbar Buttons
- Toolbar Button One – My Phone Calls List
- Toolbar Button Two – Start Batch Mode
- Toolbar Button Three – End Batch Mode
-
Events
- Event One – DeskTopReady
- Event Two – Session Closed
Entity Search
First of all I needed an entity search, this would be used to find the first phone call in my phone calls view. If you haven’t used an entity search before, these are simply fetchXML queries that can be run from USD actions. My search is shown below.
Tip:
One simple way to get the FetchXML for an entity search is to create your query using advanced find and then use the “Download XML” button. (To create my query I opened the “My Phone Calls” view in advanced find and downloaded the FetchXML!)
My entity search looked like this …
![]()
Here is a copy of my fetch command;
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
<entity name="phonecall">
<attribute name="activityid"/>
<order descending="false" attribute="scheduledend"/>
<filter type="and">
<condition attribute="statecode" value="0" operator="eq"/>
</filter>
<link-entity name="activityparty" alias="aa" to="activityid" from="activityid">
<filter type="and">
<condition attribute="participationtypemask" operator="in">
<value>2</value>
<value>1</value>
<value>9</value>
</condition>
<condition attribute="partyid" operator="eq-userid"/>
</filter>
</link-entity>
</entity>
</fetch>
Actions
Several new actions where required, I will describe each one in detail below. Afterwards I will then explain how these were added to events and toolbar buttons to achieve the results shown in my demo video.
Action One – Do Search for next phone call
The first action you will need is used to trigger the entity search I described above. My action is shown below.
![]()
Notice the line “maxcount=1”. This is important as I only ever want to return the first record, hence I will always return one or zero records.
The table below give details of each field in this action;
Field |
Details |
Name |
CRM Global Manager – Do Search (MyPhoneCallsBatchMode) |
Order |
20
The order is significant. (It should make sense later in this post! When I describe which toolbar buttons / events will include these actions.) |
Hosted Control |
CRM Global Manager
|
Action |
DoSearch |
Data |
name=MyPhoneCallsBatchMode
maxcount=1
The name is the name of my entity search. The maxcount field will ensure only one row is returned. |
Condition |
“[[$Settings.PhoneCallBatchMode]g]”==”true”
The purpose of this condition is to ensure that the search is only executed when working in batch mode. As it will be possible to load one phone call after another. Or one at once. |
Action Two – Pop phone call found with search
When the search returns a phone call I will want to open it. This action will pop up the phone call.
Being an “Open_CRM_Page” action from the “My Work” tab is important! As I already have a window navigation rule that will create a session for any phone call loaded from the “My Work” tab.
![]()
The table below give details of each field in this action;
Field |
Details |
Name |
My Work – Open CRM Page (Popup Phonecall, Batchmode) |
Order |
30
The order is significant. (It should make sense later in this post! When I describe which toolbar buttons / events will include these actions.)In this case the order of 30 is used so that this action happens after the entity search. |
Hosted Control |
My Work
|
Action |
Open_CRM_Page |
Data |
LogicalName=phonecall
id=[[MyPhoneCallsBatchMode.activityid]g]
Logical name is for the phone call entity. The ID field is the GUID for the phone call returned by the entity search. |
Condition |
“[[$Settings.PhoneCallBatchMode]+g]”==”true” && “[[$Return.CRM Global Manager – Do Search (MyPhoneCallsBatchMode)]+g]”==”1”
The purpose of this condition is to only try to load the CRM page if we are working in batch mode and also a record has been returned by the entity search. |
Action Three – Display message when batch is complete
Next I needed an action that will display a message if the search returns no results. This could happen in two circumstances! Either the last phone call has been made or someone tries to start a batch and no phone calls exist.
![]()
The table below give details of each field in this action;
Field |
Details |
Name |
CRM Global Manager – Display Message (BatchMyPhoneCalls, Batch End) |
Order |
30
The order is significant. (It should make sense later in this post! When I describe which toolbar buttons / events will include these actions.)In this case the order of 30 is used so that this action happens after the entity search.
|
Hosted Control |
CRM Global Manager |
Action |
DisplayMessage |
Data |
text=All phone calls have been processed
caption=PHONE CALLS COMPLETE |
Condition |
“[[$Settings.PhoneCallBatchMode]+g]”==”true” && “[[$Return.CRM Global Manager – Do Search (MyPhoneCallsBatchMode)]+g]”==”0”
The purpose of this condition is to only display the message if we are working in batch mode and also no records have been returned by the entity search. |
My display message action has a sub action. You get to sub actions from the navigation bar. (As shown below.)
![]()
Below you can see that the display message action has a sub action called “CRM Global Manager – Save Setting (PhoneCallBatchMode, false)”. This action is used to ensure batch mode is cancelled if no more phone call records exist. I haven’t yet described how top create this action! So we’ll look at that next!!
![]()
Action Four – Set Batch Mode, False
The next action is used to save a user setting that batch mode is not active. I use user settings as these are global and not linked to any specific session.
![]()
The table below give details of each field in this action;
Field |
Details |
Name |
CRM Global Manager – Save Setting (PhoneCallBatchMode, false) |
Order |
10
The order is significant. (It should make sense later in this post! When I describe which toolbar buttons / events will include these actions.)
|
Hosted Control |
CRM Global Manager |
Action |
SaveSetting |
Data |
name=PhoneCallBatchMode
value=false |
Condition |
N/A |
Action Five – Set Batch Mode, True
The previous action was used to cancel the batch mode, so this action is the reverse as it will be used to flag that batch mode is active.
![]()
The table below give details of each field in this action;
Field |
Details |
Name |
CRM Global Manager – Save Setting (PhoneCallBatchMode, true) |
Order |
10
The order is significant. (It should make sense later in this post! When I describe which toolbar buttons / events will include these actions.)
|
Hosted Control |
CRM Global Manager |
Action |
SaveSetting |
Data |
name=PhoneCallBatchMode
value=true |
Condition |
N/A |
Action Six – Refresh my work tab
I have described that I already have a “My Work” tab that contains a list of phone calls. When in batch mode I still show this tab. As each call is completed I will want to refresh the tab to ensure the latest information is shown.
![]()
The table below give details of each field in this action;
Field |
Details |
Name |
My Work – Refresh (Conditional, BatchMyPhoneCalls) |
Order |
40
The order is significant. (It should make sense later in this post! When I describe which toolbar buttons / events will include these actions.)
|
Hosted Control |
My Work |
Action |
Refresh |
Data |
N/A |
Condition |
“[[$Settings.PhoneCallBatchMode]g]”==”true”
This condition ensures that the “My Work” tab is only refreshed when we are in batch mode. |
Action Seven – Close My Work Tab
This is a simple action, it is used to close the my work tab when we exit batch mode.
![]()
The table below give details of each field in this action;
Field |
Details |
Name |
My Work – Close |
Order |
N/A |
Hosted Control |
My Work |
Action |
Close |
Data |
N/A |
Condition |
N/A |
Action Eight – My work find
I actually already had this action! It is used to display the list of “My Phone Calls” in the “My Work” tab. But as I use it in toolbar buttons in this alteration I have included it for completeness.
![]()
The table below give details of each field in this action;
Field |
Details |
Name |
My Work – Find (Phonecall) |
Order |
N/A |
Hosted Control |
My Work |
Action |
Find |
Data |
phonecall |
Condition |
N/A |
Toolbar buttons
Below I describe the toolbar buttons required. You will probably locate these on different toolbars to me! But regardless of the position you use the logic of the buttons is what matters.
Tip:
I actually repeated some of my buttons, as I have given the user the ability to stop batch mode from multiple positions in my interface.
Below you can see that I have three buttons. One which simply opens the My Work tab “normally”, so not in batch more. The second starts batch mode. And the third allows the user to stop batch mode. (Maybe when they need to take a break!) In the following sections I will describe all three of these buttons.
![]()
Toolbar Button One – My Phone Calls List
My first toolbar button simply opens the “My Phone Calls” view in the “My Work” tab. I had this button originally but needed to make one change, as I wanted to ensure batch mode wasn’t active.
This toolbar button basically triggers two actions;
- CRM Global Manager – Save Setting (PhoneCallBatchMode, false)
- My Work – Find (Phonecall)
![]()
Toolbar Button Two – Start Batch Mode
The Start Batch Mode button included five actions (with the order being significant!);
- CRM Global Manager – SaveSetting (PhoneCallBatchMode, True)
- CRM Global Manager – Do Search (MyPhoneCallsBatchMode)
- My Work – Find (Phonecall)
- CRM Global Manager – Display Message (BatchMyPhoneCalls, Batch End)
Notice that I added an image. Mine was called “neil_play”, yours would have a different name. Maybe “new_play” if you are using the default publisher. Adding the icon is optional, if you want to include an icon you’ll simply need to import a suitable image file as a webresource in customizations.
The condition is important, as I didn’t want the “start batch mode” option to be available if the batch mode was already active.
“[[$Settings.PhoneCallBatchMode]g]”==”false”
![]()
Toolbar Button Three – End Batch Mode
The end batch mode button simply contains two actions. One will close the “My Work” tab and the other changes the user setting so that batch more is no longer active.
The effect of this means that when the user closes the current session the we will no longer try to open a new session. The actions are therefore;
- My Work – Close
- CRM Global Manager – Save Setting (PhoneCallBatchMode, false)
Again I added an image to this button, which is optional.
Notice that I have a condition so this button is only enabled when in batch mode.
“[[$Settings.PhoneCallBatchMode]g]”==”true”
![]()
Events
Event One – DeskTopReady
I needed to add actions to just two events. Firstly on DeskTopReady of CRMN Global Manager (so the load of USD), I wanted to ensure that batch mode wasn’t enabled. This was to avoid any issues of batch mode being active previously when USD had been closed. I simply added one action to my DeskTopReady event “CRM Global Manager – Save Settiing (PhoneCallBatchMode, false)”.
![]()
Event Two – SessionClosed
The next event I change swas my “SessionClosed” event on the session tabs. As when in batch mode I wanted the close of a session to trigger a search and potentially start a new session as required.
Below you can see that I added the following actions to my SessionClosed event;
- CRM Global Manager – Do Search (MyPhoneCallsBatchMode)
- CRM Global Manager – Display Message (BatchMyPhoneCalls, Batch End)
- My Work – Open CRM Page(Popup Phonecall, Batchmode)
- My Work – Refresh (Conditional, BatchMyPhoneCalls)
The result being a search is preformed, if no results are found a message is given. If a record is found a new session is started containing that phone call. Then the refresh command will ensure the “My Work” tab is kept current.
![]()
This is a complicated change! I have documented it not thinking you will follow it exactly. The idea was really to give an outline of how I have implemented this feature and therefore allow you to “steal” the design concept and adapt for your own purposes. Hopefully this approach will have shown some inventive ways to use user settings, entity searches etc. Enjoy.
Filed under:
USD - Configuration Tagged:
Unified Service Desk