Applies to: Dynamics 365 Organization 9.0+ with Universal Resource Scheduling 3.8.x version

 

In the latest Field Service v8.8.x/Universal Resource Scheduling v3.8.x update, we released the Search Resource Availability API for scheduling single requirements. A list of available resources and their time slots can be retrieved by passing the details of a single resource requirement to this API as input. In this blog post, we will walk you through a scenario with an example of how to use this API.

Let’s consider this scenario: You are looking for list of available resources and their time slots for a requirement in which you have specific constraintsFrom and To dates of the requirement, Duration of the requirement, Effort needed for the requirement, Resource Types, Resource Characteristics, Rating, Roles, Territories, Organizational Units, and Resource preferences (preferred and restricted resources).

To be precise, in our example we are looking for available robotics technicians (Resources: Account, Contact, User) for three hours of work over the next three days, who are familiar with assembly maintenance in the Washington Territory and belong to the Organizational Units Seattle OU or Redmond OU.

Here is the list of input parameters used for our resource requirement and the exact values used in our example:

InputDescriptionTypeMandatoryValue used in this example
VersionVersion number of the API to be calledStringYes1.0.0
FromDateFrom Date on the requirementDate and TimeNoToday
ToDateTo Date on the requirementDate and TimeNoNext 3 days
DurationDuration in minutesWhole NumberNo3 hours = 180 mins
EffortEffort/capacity needed for the requirementEffortNo1
ResourceTypesThe type of resource needed for the requirement (example: Account, Contact, Crew)Whole NumberNo2,3,5 (Account, Contact, User)
RestrictedResourcesResources to be excluded from the available resource suggestionsGUIDNo‘8F419662-1BE7-E611-8102-E0071B69FFE1′,’07F73BD9-17F3-E611-8112-E0071B66BF01’
(Brady Hannon/Edgar Ramirez)
PreferredResourcesResources to be included in the available resource suggestionsGUIDNo1FF73BD9-17F3-E611-8112-E0071B66BF01′, ‘0BF73BD9-17F3-E611-8112-E0071B66BF01’
(Jorge Gault, Joseph Gonsalves)
CharacteristicsBookable resource characteristics needed for the requirementGUIDNo‘FAC12CAB-1BE7-E611-8102-E0071B69FFE1’ (Assembly Maintenance)
RatingsMinimum rating needed for a resource characteristic on the requirementIntegerNo1 (Familiar)
RolesResource categories/roles needed for the requirementGUIDNo‘EB357955-1AE7-E611-80F4-E0071B661F01’ (Robotics Technician)
TerritoriesResource territories needed for the requirementGUIDNo‘395C7D14-1CE7-E611-8102-E0071B69FFE1’ (Washington)
OrganizationUnitsResource organization units required for the requirementGUIDNo‘6AAEE41E-CA82-E911-A979-000D3AC041FB’, ’68AEE41E-CA82-E911-A979-000D3AC041FB’
(Seattle/Redmond)

 

Note:

  • To run this API, we are going to need the GUIDs for the BookableResources, Characteristics, Roles, Territories, and Organizational Units, which you can retrieve using the Web API.
  • If the API is called from a client (browser or an app like canvas app) that is based on JavaScript/TypeScript, you would need to have the extended SOAP SDK, which is provided in the sample files for download.
  • The extended SOAP SDK is not a Microsoft official release but is provided in the sample for guidance.
  • We suggest you test this in your development or test environments first to validate your scenarios and results before you run it in your production environments.

To execute this search against your organization, you can download the sample files here. Once you download the sample folder, follow these steps:

  1. Modify the hard-coded input parameters provided in the sample.js file to reflect the GUIDs of records (for example, Resources, Characteristics, Territories) in your org.
    • SA API Sample 1
  2. Add the files in the Sample folder as web resources in your organization.
    • SA API Sample 2
    • SA API Sample 3
  3. Navigate to the newly added sample.htm page. It would look like <<YourOrgURL>>//WebResources/new_sample.htm.
    • SA API Sample 4
  4. Open the browser’s developer tools by using the F12 function key. Set breakpoints as needed and inspect the request/responses in the Developer Tool’s console.
    • SA API Sample 5
    • SA API Sample 7

 

We can see the list of time slots returned for the resources who match the search criteria with time slot types Off, Available, Scheduled returned. Jorge GaultandJoseph Gonsalvesare the two potential resources who can fulfill our Resource Requirement/Work Orderbetween the times of 09:00 to 17:00 hours GMT on June 26th and 27th.

Once these time slots are returned by the API, you could choose to display the available time slots on your custom web portal, app or a canvas app. If the user chooses an available time slot, you could use your custom logic to create a booking.

A few other scenarios that could leverage the API are as follows:

  • Build a custom web app or a Dynamics 365 portal to provide appointment scheduling for their end users to show the available time slots for the service/product they offer from a Dynamics 365 CE organization data.
  • Build a PowerApps canvas app to support scheduling scenarios for their line-of-business apps.

 

Vinay Nalam,

Program Manager, Dynamics 365 Engineering

 

Additional Resources:

Docs: The primary documentation for Dynamics 365 for Field Service.

Scheduling Docs: Documentation for Resource Scheduling.

Learn: Learning path for Resource Scheduling.

Field Service YouTube Channel: Includes concept videos for Field Service.

Ideas: The portal where you can contribute product feedback and ideas for Resource Scheduling.

Forum: Go here to ask questions, find answers, and see upcoming events.

Blog: On the blog, you’ll find ongoing release notes and posts from the product team.

The post How to use Resource Scheduling’s Search Resource Availability API appeared first on Dynamics 365 Blog.