USD FireEvent in Custom Hosted Controls

2 Comments

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.

  1. Go to the Test Fire Event Custom Hosted control

  2. Create an event called CreateNotes. This is what we have called the event we are firing in the USD submit button

  3. Create a new action call (we will come back to filling this in after step 5):

  4. Create new UII Action:

  5. 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:

  6. 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:

 

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, BI, Web, Cloud and Data Science.

carldesouza.comLinkedIn Twitter | YouTube

 

2 Responses to USD FireEvent in Custom Hosted Controls

    • 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

Leave a Reply

Your email address will not be published. Required fields are marked *