Sort available resources by total available time in Universal Resource Scheduling

Applies to: Field Service (version 7.2.0.43), Project Service Automation (version 2.2.0.74), and Universal Resource Scheduling (URS) solution (version 2.2.0.49) on Dynamics 365 9.0.x

Want to be sure you assign work efficiently, taking care not to over or under book people on the schedule board?

In the December 2017 update, we added out-of-the-box functionality that allows users to sort resources by total availability, making it easier to load-balance across your team.

Previously, the system included two out-of-the-box options for sorting results when searching for available resources, plus any additional custom sort options. Now the system includes this third sort option.

For example, let’s say a user wants to find the most under- or over-utilized resources. The user can select the total availability sort option, and then choose ascending or descending order.  

Note that only certain resources are considered eligible for work. So, assuming a resource is eligible, and is returned as a possible candidate presented on the schedule board, the sort option shows the resource with the most or least total hours available within the date range. 

Read on if you’re an implementer or admin who wants to know more about how the sort works.

As we enhance our out-of-the-box scheduling capabilities, we modify the queries stored on the msdyn_configuration entity used for scheduling. However, to prevent unintentionally breaking any customizations you’ve already published, we ship new configuration records with system updates, instead of modifying existing ones.

Therefore, when you update your organization to the latest release, you’ll notice a new record called Default Schedule Assistant Filter Layout (UR2) when you navigate via Advanced Find to the configuration entity.

Default Schedule Assistant Filter Layout

 

If this is a brand new organization, or if this is an existing organization with no customizations, then the Default Schedule Assistant Filter Layout (UR2) already contains these latest capabilities and is set up for you. There’s nothing else you need to do.

If you aren’t sure how to check if there are customizations, read on to learn where these settings are stored so you can check.

If you have customized the out-of-the-box scheduling experience by creating new configuration records and using them in your Schedule Assistant searches, you likely have changes you would like to preserve. You’ll need to manually add the new feature to your custom queries to take advantage of the new functionality. Good news is that it’s simple and this blog post walks you through step by step.

To add the sort by available time option to a custom query, simply add a single line to your filter query.

More good news: usually a customization to the sort options also requires a change to the resource query, but this new sort option is unique. Because sorting by availability requires the system to iterate over all the bookings for each resource in the search, which is not something exposed to customers, the system uses a “magic tag” in the filter query to trigger the code to execute and bring back the values needed to sort by total available time.

To add this feature to a custom query:

  1. Find the Schedule Assistant filter configuration record you want to add the sorting to, and then double click the Schedule Board.
  2. Click Open default settings.

Open Default Settings

  1. Scroll and expand the Schedule Types.
  2. Select the Schedule Type you would like to add the total availability sorting to. In the example, None is selected for a requirement not linked to any schedulable header such as a work order, project, or case. This is also the default for other schedule types.
  3. Click the Settings icon for the Schedule Assistant Filter Layout.

Schedule Assistant Filter Layout

 

  1. Click Save As to save a new msdyn_configuration record. This closes the window and links the filter to the new one.

Save a new msdyn_configuration record

 

While you can edit the query in the configuration window, it’s a good practice to copy and paste the content into your favorite XML editor, make the changes there, and then copy and paste the changed query back into the configuration window. So click the Settings icon one more time to launch the editor, select all content and copy it, and then paste it into an XML editor.

Find the line in which the Order filter control is defined. This is where the sorting options are defined in the filter control.

 

Find Order filter control

 

Insert the following line under one of your other sort/order options, but above the end of the control section marked by “</control>” just below the arrow in the below image. You can see this line already inserted into the image below where the arrow is pointed. The line to insert is:

<order name=”totalavailabletime” entity=”bookableresource” attribute=”totalavailabletime” label-id=”ScheduleAssistant.Center.slotsgrid.TotalAvailableTime” />

 

Totalavailabletime order name

 

Below is another image showing how to use the new property in the filter panel’s order control.

Use new property in filter panel's order control

Note that the label of the added property is determined by the localized label:

“ScheduleAssistant.Center.slotsgrid.TotalAvailableTime"”.

There’s an added attribute called “totalavailabletime” in the retrieve availability server call to allow the resources to be sorted on this attribute.

Now select this entire query and paste it back into the newly created configuration record, and then click Save. The line you added appears. Don’t worry if it’s indented a bit, but feel free to fix it, if you are so inclined.

Select and paste query in the new configuration record

 

If you have other types of entities that can be scheduled, and if those entities are set with the defaults (the same layout used on the None schedule type), then these entities will use the new default query on the default schedule board. So you only need to make this change once for the None schedule type, and because the other schedule types use the defaults, the value is inherited. Check out the screenshot below to for the defaults. Notice that for project type requirements, the system uses the default, which means it uses the settings from schedule type None.

Set schedule assistant filter layout for project type

 

However, if you customize the layout for other schedule types and they do not use the default, then follow these same steps for each schedule type that doesn’t point to default.

Check out this example:

Set Sort Result By

Sort in ascending order to see the resources with the most total available hours, or sort in descending order to see the eligible resources with the fewest total available hours.

Happy Scheduling!

Dan Gittler, Sr. Program Manager, Dynamics 365 Engineering