I am trying to find resource availability based on Characterstics, Category and organizational unit using plugin. Is there way to call action msdyn_SearchResourceAvailability using Plugin.
Entity requirement = new Entity("msdyn_resourcerequirement");
requirement["msdyn_fromdate"] = bookingDate;
requirement["msdyn_todate"] = bookingDate.Add(TimeSpan.FromMinutes(Convert.ToDouble(estimatedDuration)));
requirement["msdyn_effort"] = 1;
requirement["msdyn_remainingduration"] = estimatedDuration;
EntityCollection characterstics = new EntityCollection();
characterstics.Entities.Add(new Entity("characteristic", preferredSkill.Id));
EntityCollection category = new EntityCollection();
category.Entities.Add(new Entity("bookableresourcecategory", preferredRole.Id));
EntityCollection orgUnit = new EntityCollection();
orgUnit.Entities.Add(new Entity("msdyn_organizationalunit", preferredOrganizationalUnit.Id));
Entity resourcespecification = new Entity("organization");
Entity constraints = new Entity("organization");
constraints["Characteristics"] = characterstics;
constraints["Roles"] = category;
resourcespecification["Constraints"] = constraints;
Entity settings = new Entity("organization");
settings.Attributes.Add("ConsiderSlotsWithProposedBookings", true);
settings.Attributes.Add("ConsiderSlotsWithLessThanRequiredCapacity", false);
OrganizationRequest reqAction = new OrganizationRequest("msdyn_SearchResourceAvailability");
reqAction["Version"] = "1";
reqAction["Requirement"] = requirement;
reqAction["Settings"] = settings;
reqAction["ResourceSpecification"] = resourcespecification;
//execute the request
OrganizationResponse response = service.Execute(reqAction);
I just achieve it!!. Here I leave the code:
OrganizationRequest req = new OrganizationRequest("msdyn_SearchResourceAvailability"); req["Version"] = "1"; req["Requirement"] = new Entity("msdyn_resourcerequirement", new Guid("1181fb75-c732-ea11-a813-000d3ab29c25")); var SettingsEntity = new Entity("organization"); SettingsEntity["ConsiderSlotsWithProposedBookings"] = true; SettingsEntity["ConsiderSlotsWithProposedBookings"] = true; req["Settings"] = SettingsEntity; var response = service.Execute(req);
Hi,
Please, can you share the c# code (or a sample request) to call this action? I'm not be able to build the request
Thank you so much!
Is it just in the plugin you see 0 total available time?
How is it seen in the resource scheduling?
Hi Erhan Keskin,
Thanks for your reply,
I have developed plugin based on the blogs links that you have added. I am able to retrieve resource based on constraints that I have set but the resource totalAvailableTime is returned as 0. I have looked into the retrieved resource bookings but there is no booking records against those resources in that specific date.
Thanks
Aashish
Hi,
Is this what you are looking for?
How to use resource scheduling search resource availability: https://cloudblogs.microsoft.com/dynamics365/it/2019/07/15/how-to-use-resource-schedulings-search-resource-availability-api/
Retrieve resource availability with universal resource scheduling api: https://cloudblogs.microsoft.com/dynamics365/it/2019/05/21/retrieve-resource-availability-with-universal-resource-scheduling-api/
Regards,
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156