Using Entity Search in Windows Navigation Rules to Get the Selected Record in USD

Leave a comment

In Unified Service Desk, when a user selects a record from a list of records, it’s useful to know which record was selected if you want to route the record in a specific way. Let’s go through an example of what this means and how we can use Entity Search in Windows Navigation Rules to do this.

Below I have a list of Contacts in an Account record in USD:

Typically, when a user selects a contact, we will want to open that contact in its own tab in USD so the user can view the contact. We don’t really care who the contact is, all contacts will open in the same USD tab.

However, what if we want to know if the contact we click on is an “Operations Analyst” and if so, we route this type of contact down a different path, e.g. opening a different hosted control (simple example). Let’s look at how we can achieve this in USD.

First, create a new Entity Search. We will call this GetContact. It is a simple FetchXML that gets all fields in the Contact. Note we are passing the Id field of the route, as [[id]]:

<fetch top="50" >
  <entity name="contact" >
    <filter>
      <condition attribute="contactid" operator="eq" value="[[Id]]" />
    </filter>
  </entity>
</fetch>

Next, let’s create the Windows Navigation Rule. We will call it Account to Contact:

And in the Result tab, we will set it to Entity Search and GetContact:

Now, start USD. When I double click on a record:

And go to the USD Debugger->Data Parameters, we see the Entity Search has created a GetContact#contact node with all the fields, including the description we are going to use that defines whether the contact is an Operations Analyst:

Back to the nav rule, let’s add some actions to route the contact accordingly:

We will simply display a message if the contact selected is Operations:

By adding a condition to see if the result of the selected entity’s description is Operations Analyst:

And for the Regular Contacts display a message:

Check if it’s Not an Operations Analyst

Add these to the routing rule:

Now in USD, click on each type of contact:

To see that we know what the user is selecting, and we can add more complex rules as required:

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

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

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

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