In an earlier post about Unified Service Desk (USD) for Microsoft Dynamics CRM 2016 I described how to create an agent script to open a phone call when a “Create Phone call” answer was selected. This approach was relatively easy to implement but had some limitations.
A few people have responded to that post as they have been “victim” to these limitations! The New_CRM_Page action I used allows a CRM page to be opened containing a phone call. With the related values set, such as from and regarding. But it was then difficult to default subject, description, direction and other fields on the phone call.
In the previous approach the phone call page was opened but the phone call wasn’t actually saved until the user decided they wanted to do that. Depending on your requirements this may or may not be viewed as a limitation.
In this post I will describe an alternative approach in which I create (a saved) phone call then load it in a tab. I have again done this from an agent script but you could also attach this logic into a toolbar or even use the concept as part of your CTI integration. Below you can see a screen shot of the agent script I have created for my contact with the new option highlighted.
When I select this option a new tab will open containing the newly created phone call. Notice that the subject, from, to and regarding fields have all been pre-populated. (You could also complete more fields if required!) Hopefully you can also tell from the ribbon bar options presented that this phone call has already been saved.
So the first thing you will need is an answer in an agent script. I’m going to assume that you know how to create agent scripts, mine is shown below.
Notice that I have highlighted my new answer. (The original I created in March is also shown!) Below you can see the content of that agent script answer. It essentially just has a name and the show tab is phone call.
On that phone call I have attached two actions. (One of which has sub actions.) You can see this below. The order here is important. As I want to create the phone call before I do “stuff” with it.
The first action creates the phone call, the second simply waits for the record for be available. Then a sub action is run to open the phone call in a tab.
Let’s look at the actions in a little more detail, starting with the create entity action.
As already mentioned my order was 10, as I wanted this to be the first action run. My hosted control is my global manager. And my action is CreateEntity.
The data field then contains the “code” to create my phone call.
The “code” I used is below. Hopefully you can see that I am setting various columns on the phone call to attributes from the contact. Importantly I can set any field in this manner.
Notice that for the to and from fields I am using the PartyList command. And also for the lookup of regarding I am using an EntityReference command.
LogicalName=phonecall subject=Call from : [[contact.fullname]] regardingobjectid=EntityReference(contact,[[contact.Id]]) to=PartyList(er["systemuser",[[$User.systemuserid]+g]]) from=PartyList(er["contact",[[contact.Id]+]])
You might not have come across this one before! Having fired the action to create my entity I need to wait (a short time) for the record to be saved before I can open it. ExecuteOnDataAvailable lets me do that.
Importantly its order is 20, as I want it to be fired after the create command. The hosted control of my global manager again and action is ExecuteOnDataAvailable.
Now my data field is important here! [[$Return.CRM Global Manage…..]], so what does that mean? Well $Return will contain the ID of the created field after the create entity action has finished. The name looks long but it is simply the name of the action of did my CreateEntity.
The ExecuteOnDataAvailable action may already exist as a uii action on your global manager hosted control. But don’t worry if it doesn’t simply add one!
What this does is nothing! At least nothing until the $Return replacement parameter returns an ID. Then it will fire the sub action(s) added to the ExecuteOnDataAvailable action. You can find these by looking in the actions navigation, as shown below.
Sub Action – Open Phone call
Now we add a simple action to open the phone call. See below that I have added one action. I have given it an order but as I’ve only added one action the order didn’t really matter!
The open phone call action looked like the one shown below. Notice my hosted control is the global manager, again. And that this time the action is Open_CRM_Page.
In my data field I enter the LogicalName of the entity I want to load. So in this example, phonecall. Then id is set to the ID of the field to open. This is the same $Return replacement parameter you used on the ExecuteOnDataAvailable action. Hopefully that now makes sense, as you can’t open the record until you have the id value available.
Window Navigation Rule
Everybody hates window navigation rules! (At least it seems that way to me.) The exact details you need here will differ depending on your specific solution.
The way I approached this was to run my solution BEFORE I added the rule. In the debugger I could then check that all of my actions were giving a success status. Plus, I could see that no existing rules were being triggered and also I saw that my phone call didn’t open.
- Now we have just seen that the create entity action was run from my global manager. So my “from” field was set to the global manager.
- The entity is obviously phonecall.
- Running an Open_CRM_Page action will open the page as a pop up. So my route type is popup.
- Destination is tab and action is route window. As that will add a tab into my session.
I guess I have also assumed you understand the USD concept of sessions.
Finally, I set the target and show tab fields to be my phone call tab.
Hopefully these instructions make sense! J
Sorry this isn’t the simplest USD change as it makes use of quite a few USD concepts. But take you time and you should be able to get this to work. Enjoy. J