Extending URS Schedule Board - Universal FetchXml - Filter By Territory

Universal Resource Scheduling (URS) Schedule Board has many great extensibility features.  While there are many knobs, switches, and levers to configure Schedule Board to suit our specific needs, we can open up the panels and play around with the wires, fuses, and printed circuit boards (PCBs) to fine-tune the Schedule Board.  Following are some of the advanced features provided by the Microsoft URS team.

  1. Filter Layout
  2. Resource Cell Template
  3. Retrieve Resources Query
  4. Booking Template
  5. Schedule Assistant Filter Layout
  6. Schedule Assistant Resource Cell Template
  7. Schedule Assistant Retrieve Resources Query
  8. Schedule Assistant Retrieve Constraints Query

In this article, I will explain a scenario where we can modify the Filter Layout and Retrieve Resources Query to achieve the required behaviour.

If you would like to know more about the main components of the Schedule Board, read this article first – http://dyn365apps.com/2019/07/12/extending-urs-schedule-board-components-of-the-schedule-board/

Filter Layout

Filter Layout is a feature we can use to configure fields on the Filter panel.

Retrieve Resources Query

Retrieve Resources Query is a feature we can use to customise the query used to retrieve resources and their bookings onto the Schedule Board.  The query uses UFX (Universal FetchXml), an advanced query language that allows us to query data using dynamic FetchXML.

Scenario

We need to create a new Tab on the Schedule Board to be used by schedulers in Melbourne, Australia.  We have created a number of records for the Territory entity (e.g. Melbourne, Sydney).  Resource Territory records are created to associate Territories to Resources.  The new Tab “Melbourne” should only show resources who are associated with “Melbourne” territory by default.

UFX - Resource Territory

 

UFX - Resource Territories

Step 1 – Create a new Tab

Click on the + button on the right-hand side of the Tabs.

UFX - Create new tab

Enter a name for the new Tab and select Everyone from the Shared With drop-down list.

UFX - Add tab

Step 2 – Create a new Retrieve Resource Query

Scroll down to Other Settings section.  Click on the gear button on the right-hand side of the Retrieve Resources Query.

UFX - Create new Retrieve Resources Query 1

The default Retrieve Resources Query is displayed.  It is recommended to NOT modify this directly.  Instead, click on the Save As button and create a new query.  Enter a suitable name and click Save.  Click Add.

UFX - Create new Retrieve Resources Query 2

Please note, behind the scenes, the system creates a new record of type “Configuration”.

Step 3 – Generate the FetchXml using Advanced Find

Open Advanced Find and configure the required query.  In this example, we need to find all Bookable Resources, where the associated Resource Territory record’s Territory field is equal to “Melbourne”.  Click on the Download Fetch XML button to download the query.  Click on the Results query to make sure we get the right results.

UFX - Advanced Find

Step 4 – Update the Retrieve Resources Query

The downloaded query is as follows.

The segment we are interested in is as follows.

Open the Retrieve Resource Query.  The section we are interested in is as follows.

Since we are not interested in using the Filter panel’s territory input to filter by territory, we can safely remove this section and replace it with the segment generated by the Advanced Find.  The final complete query is as follows.

Now, by default, The new Melbourne Tab only shows Resources with associated Resource Territory records with Territory set to “Melbourne”.

Step 5 – Update the Filter Layout

At this stage, changing the Territory filter from the Filter Panel has no impact on the Retrieve Resources Query since we removed the Territory input from the query.  Let’s remove this field from the Filter Panel.  To do this, we need to modify the Filter Layout.

UFX - Filter Layout

Similar to the last time, it is recommended to create a new Filter Layout instead of modifying the default.

UFX - Add new filter layout

 

Remove the following line.  This will remove the Territory control from the Filter Panel.

The complete Filter Layout is as follows.

The Filter Panel now looks as below.  The filter control is not available.

UFX - Modified Filter Panel

References

Docs – https://docs.microsoft.com/en-us/dynamics365/customer-engagement/field-service/configure-schedule-board

Docs – https://docs.microsoft.com/en-us/dynamics365/customer-engagement/common-scheduler/developer/extending-urs-step-by-step

Docs – https://docs.microsoft.com/en-us/dynamics365/customer-engagement/common-scheduler/schedule-anything-with-universal-resource-scheduling

Docs – https://docs.microsoft.com/en-us/dynamics365/customer-engagement/common-scheduler/developer/universal-fetchxml

Docs – https://docs.microsoft.com/en-us/dynamics365/customer-engagement/common-scheduler/developer/extensibility-release-notes

D365 CE Team Blog – https://cloudblogs.microsoft.com/dynamics365/it/2017/10/16/blog-post-july-2017-update-for-field-service-and-project-service-automation-universal-resource-scheduling-part-1/

D365 CE Team Blog – https://cloudblogs.microsoft.com/dynamics365/it/2017/10/16/july-2017-update-for-field-service-and-project-service-automation-universal-resource-scheduling-part-2

 

Thank you for visiting Dyn365Apps.com.

Follow me on Twitter – 

Until next time…

About the Author

Nadeeja Bomiriya is a Microsoft MVP, Chapter Lead – Dynamics 365 Saturday – Australia, Sri Lanka, Committee Member – Melbourne Dynamics 365 User Group, Technical Architect, and Dynamics 365 Practice Lead who lives in Melbourne, Australia.

Disclaimer: This blog post contains opinions of my own and not the views of my employer.

Extending URS Schedule Board – Permanently Filter a Tab by a Specific Territory
Tagged on: