Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Field Service updates!Learn about the key capabilities and features of Dynamics 365 Field Service and experience some of the new features.
Download overview guide | Watch Field Service video
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
With the depreciation of the existing service scheduling capabilities, to be replaced with the new unified scheduling engine. How, using the custom actions/api should we be querying the new scheduling engine to find available time slots?
How to get time slots using msdyn_SearchResourceAvailability API?
Any help would be greatly appreciated!
Hi Sabina Khanna
The solution is available in the following links.
Link 2: https://cloudblogs.microsoft.com/dynamics365/it/2019/07/15/how-to-use-resource-schedulings-search-resource-availability-api/
Thanks for the reply.
I went through both of these links but When I tried to assign an entity in "Settings" parameter I am getting an error "object reference not set to an instance of an object".
Basically I didn't understand below line in the first link in "Settings" section.
"Settings are specified as attributes in an entity bag. The type of does not matter, you can specify any entity logical name".
What to pass in "Settings" parameter of "msdyn_SearchResourceAvailability" api ????
Below are the input parameters for "msdyn_SearchResourceAvailability" API. Out of 4 parameters 3rd one is not clear.
1. Version - string (Mandatory)
2. Requirement - Need to pass "resource requirement" entity details (Mandatory)
3. Settings - from which entity??? (Mandatory)
4 ResourceSpecification - from which entity (Can skip this as not Mandatory)
Hi Sabina.I am using C# to call the API and it worked fine for me, I will share my code and happy to help if you need.
public OrganizationRequest Create()
var req = new OrganizationRequest()
RequestName = "msdyn_searchresourceavailability"
// Resource Requirement
Entity newReqObject = new Entity("msdyn_resourcerequirement");
newReqObject["msdyn_fromdate"] = new DateTime(2019, 11, 11, 8, 30, 0, DateTimeKind.Local).ToUniversalTime();
newReqObject["msdyn_todate"] = new DateTime(2019, 11, 15, 17, 30, 0, DateTimeKind.Local).ToUniversalTime();
newReqObject["msdyn_remainingduration"] = 30;
newReqObject["msdyn_duration"] = 30;
// These three fields are not in the document but you use to filter the location
newReqObject["msdyn_worklocation"] = new OptionSetValue(690970000);
newReqObject["msdyn_latitude"] = -43.50185;
newReqObject["msdyn_longitude"] = 172.59811;
Entity travelRadius = new Entity("travelradius");
travelRadius["Value"] = 50;
travelRadius["Unit"] = 192350001;
Entity settings = new Entity("systemuser");
settings["MaxResourceTravelRadius"] = travelRadius;
settings["ConsiderTravelTime"] = true;
settings["UseRealTimeResourceLocation"] = true;
// Rescourse Specification
var rescourseSpecificationEntity = new Entity
LogicalName = "systemuser"
EntityCollection characteristicsUnitEntityCollection = new EntityCollection();
Entity characteristic1 = new Entity();
characteristic1.Attributes.Add("characteristic", new EntityReference("characteristic", new Guid("98e62c87-f7d1-4c4b-bca7-9531ae91da99")));
Entity characteristic2 = new Entity();
characteristic2.Attributes.Add("characteristic", new EntityReference("characteristic", new Guid("98e62c87-f7d1-4c4b-bca7-9531ae91da99")));
EntityCollection territoriesEntityCollection = new EntityCollection();
Entity territory = new Entity();
territory.Attributes.Add("territory", new EntityReference("territory", new Guid("98e62c87-f7d1-4c4b-bca7-9531ae91da99")));
EntityCollection teamsEntityCollection = new EntityCollection();
Entity team = new Entity();
team.Attributes.Add("team", new EntityReference("team", new Guid("98e62c87-f7d1-4c4b-bca7-9531ae91da99")));
EntityCollection BUEntityCollection = new EntityCollection()
 = new Entity("businessunit", new Guid("98e62c87-f7d1-4c4b-bca7-9531ae91da99"))
// Add to constraint
var constraintEntity = new Entity("systemuser");
// Add to request object
req["Version"] = "1";
req["Settings"] = settings;
req["Requirement"] = newReqObject;
// Optional - Use it to filter the resources
req["ResourceSpecification"] = rescourseSpecificationEntity;
Have you tried "Roles" in constraint in above code that you have shared. If yes, did that work out?
Hi Gabriel, Could you please share the code. Thanks in advance.
Follow these steps according to the sample.js file you create in Microsoft D365:.
I hope this helps you!
More over here :https://cloudblogs.microsoft.com/dynamics365/it/2019/07/15/how-to-use-resource-schedulings-search-resource-availability-api/
This code for the plugin is registered against which event on which entity? I'm assuming not the create/update of the resource requirement record.
Also thanks so much for sharing your code, your help is super appreciated.
Yes, you can register this the plugin at any event. I haven't used it on Flow but I think could be a good idea. You may need to use a generic HTTP Request for it.
You could register on the Resource Requirement (async) but I don't recommend. There are a lot of Microsoft plugins running to create the calendar, adding the preferred resources and so on.
Business Applications communities