Exchange information between Unified Service Desk and Standard Web Applications
Interacting with a web page inside USD implies reacting to specifics events on the USD side. For example, answer a new call, move forward on an agent script, load another web page, fill in some business or customer data, navigate and return some useful outputs from the web page back to USD to continue the automation process and agent guidance.
In this post, I am going to focus on a simple example that demonstrates how to get information from Microsoft Dynamics CRM and USD to pass it over to a web application, and then navigate and return values back to USD. To achieve this, knowledge about some core USD concepts are required, such as Action Calls, Replacement Parameters, Hosted Controls, Events and others. More information: MSDN: Core concepts for configuring Unified Service Desk
Let’s suppose that during a shipment process, the Contact Center Agent must verify that the city and zip code stored on Dynamics CRM matches with the information on the USPS website, which will be used to deliver the shipment. In this case, we want USD to take the contact ZIP from CRM, open the USPS page, search for the address based on that ZIP and return the City name back to USD.
Pass information from USD to web page
We will configure USD to automatically pass information to a web page.
1. Create a Standard Web Application type of hosted control called Zip Lookup to host the USPS web page inside USD. Configure it to be visible on the main panel. However, in a real world scenario, the automation could happen in a hidden panel, and just display the result to the user.
2. Add an action call called ZIP navigate for the Navigate action on the hosted control you created in step 1 by specifying the following value in the Data field for the action:
document.forms['ziplookup1'].elements['tZip'].value = "[[contact.address1_postalcode]]";
4. To automatically run the Zip Lookup Action action call when the hosted control loads in USD, add the Zip Lookup Action action call to the BrowserDocumentComplete event for the Zip Lookup hosted control.
5. Configure to open the Zip Lookup hosted control from an agent script. When the hosted control loads, it automatically navigates to the correct tab on the USPS web page, fills the ZIP code on the form with the information stored in the [[contact.address1_postalcode]] replacement parameter, and submits the form to display the result.
This demonstrates a basic automation scenario of passing information from USD to a web page.
Return information from web page to USD
I will now demonstrate two different ways to return information from the web Page to USD to complete the information exchange scenario.
Method 1: Return information in the $Return replacement parameter
This method returns the information from the Web page to the $Return replacement parameter in USD.
var url = "[[url]]";
2. Add the ReturnOnCityLocated action call to the BrowserDocumentComplete event for the Zip Lookup hosted control so that its executed as soon as the hosted control completes loading.
You can also use special actions to execute right after this replacement parameter becomes available. Learn more at: https://blogs.msdn.microsoft.com/usd/2015/09/25/how-to-use-the-special-actions-executeontimeout-executeondataavailable-executeonexpressiontrue/
Method 2: Return information using the event moniker ( http://event )
1. Create an action call called Display Event Params for the DisplayMessage action on Global Manager hosted control with the following value in the Data field:
2. Add a user-defined event called CityLocated on the Zip Lookup hosted control, and then add the Display Event Params action call to this event.
var url = "[[url]]";
var city = document.getElementsByClassName("std-address").innerHTML.split('');
var state = document.getElementsByClassName("std-address").innerHTML.split('');
4. Add the RaiseEventOnCityLocated action call to the BrowserDocumentComplete event for the Zip Lookup hosted control so that its executed as soon as the hosted control completes loading.
The city and state name are displayed in a message box when the Zip Lookup hosted control loads in USD.
In the CityLocated event, you can add any logic for automation in USD. In this example, we just displayed a message box with the information returned from the web page.
You can easily configure USD to exchange information with web applications, and build very powerful automations that simplifies agent’s processes and reduces average handling time (AHT).