In this topic, we will go through how to integrate USD with a website. In the scenario, an agent may need to look up information in a website and would want to do this within the context and session of USD.
Let’s go through the example on MSDN here.
Firstly, open the project located in the UII SDK – UII\SampleCode\UII\AIF\QsWebApplication.
You may need to replace the Microsoft.Uii.Csr.Core dll with the one from the UII\Bin\UII directory.
Let’s look at the code. The default page is pretty simple, setting the text boxes:
Save the solution and then compile the project. Press F5 and you will see the website URL:
Next, create a hosted control in the Dynamics 365, with the highlighted parameters:
At this point we can confirm USD is configured to open the new hosted control. On signing in, we see the control.
Next, we will create a web application adapter to get USD to talk to the web application.
In Visual Studio, create a new project. Select USD->UII Web Application Adapter:
The project will look like below when you open it:
If you have missing references, you can re-add these from the assemblies in the UII\Bin\UII directory.
Under Uii Methods, there is NotifyContextChange:
We will add code here to pick up the values from the context. NotifyContextChange runs when there is a change in the context. When we open a new contact, we will be able to get these values (firstname, lastname, address1_line1, CustomerID) and assign them to our hosted control’s text fields:
Also, ensure to add the using mshtml line or you will get compile errors on HTMLDocument:
Compile and build. We will now configure the application adapter. Go to the hosted control we set up in the USD configuration and change the Adapter Configuration to:
The URI is the assembly name and the Type is the assembly name and default class, in this case WebAdapter:
To deploy the code to the client, copy the code to the USD client folder:
We can now test this in USD. Launch the USD client. At first, there is nothing in the hosted control:
Click on Search and select the Patrick sample:
The sample application is populated with the data:
We can see the context variables in the debugger:
Update the Last Name:
Note the web application is now also updated: