In Unified Service Desk, custom hosted controls can fire events in USD through code. Here we will look at how to use this functionality.
In this example, we will create a custom hosted control that displays information about a case selected in USD. We will then simulate updating the case from our custom hosted control using the FireEvent method in the control to call an event in USD.
Create a new USD custom hosted control:
Create a new USD control that has 3 fields and a submit button:
- Case Title – txtCaseTitle
- Notes – txtNotes
On running the default action in USD (opening the control), we will run code to populate the case name. We will also add code when our new event, CreateNote, is called. When this is called, our custom control will pick up the event and process it by displaying what the user entered into the notes text box:
Add code to the Submit button change event. Here we will call the FireEvent in USD. Note the FireEvent expects either a string as the argument or a string and a dictionary as arguments:
We will add code to fire an event in USD called CreateNotes. This will in turn call :
Next, compile the code and copy the project DLL to the USD folder:
Now in USD, we will register this hosted control. Go to Hosted Controls and click New:
Next, we will open the new hosted control when a user opens an Incident:
Create a default action on the new hosted control to open it:
Now, open USD and go to an Incident. The custom hosted control will load, with the case title populated:
Now we will set up the events to run the Submit.
- Go to the Test Fire Event Custom Hosted control
- Create an event called CreateNotes. This is what we have called the event we are firing in the USD submit button
- Create a new action call (we will come back to filling this in after step 5):
- Create new UII Action:
- Save the action call from 3 above, with the createnote UII action selected. In the Data area, pass the notes we received from the custom control:
- Ensure Create Note is selected as an action on the event:
USD is now ready to process the CreateNotes event. Select an incident and the new control will open. Click Submit, and what the user entered will be displayed via a USD event:
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL
Could you please show steps how you have configured the incident hosted control.
Hi Arunav,
Incident hosted control:
– Type = CRM Page
– Hosting Type = IE Process
– Application is Global = false
– Display Group = Main Panel
– Adapter = Use No Adapter
– Application is Dynamic = Yes