Announcements
Hi All,
Has anyone had any luck with the subject message/api? I have able to implement this in c#. It's working and getting all the resources but when I add constraints it doesn't return anything. Tried a lot of different things but no luck.
What I am trying to achieve is to automate the booking. When a work order is created, I would like to assign the work order to the best resources based on the constraints of the work order. If there's another way, please let me know.
Hi dyn365,
Here an example:
OrganizationRequest req = new OrganizationRequest("msdyn_SearchResourceAvailability"); req["Version"] = "1.0"; var requirement = new Entity("msdyn_resourcerequirement"); if (WorkOrderStartTime != default) requirement["msdyn_fromdate"] = WorkOrderStartTime; if (WorkOrderEndTime != default) requirement["msdyn_todate"] = WorkOrderEndTime; if (WorkOrderStartTime != default && WorkOrderEndTime != default) requirement["msdyn_duration"] = Math.Round((WorkOrderEndTime - WorkOrderStartTime).TotalMinutes, 0); req["Requirement"] = requirement; var SettingsEntity = new Entity("organization"); SettingsEntity["MovePastStartDateToCurrentDate"] = true; //SettingsEntity["ConsiderSlotsWithLessThanRequiredCapacity"] = true; req["Settings"] = SettingsEntity; var response = service.Execute(req);
I hope it helps you
Hi Enrique
Thanks for your reply and code.
I have written the code and it's similar to what is mentioned here. My scenario is very simple. I have four contractors working in a different territory. I am just trying to get the contractor which is suitable for the current requirement. If I pass the requirement entity to the webapi, it returns all four contractors, however, as soon as I add territory to the requirement, nothing comes back.
There's no other restrictions or constraint which could be blocking. I am testing this in a plain vanilla environment. When I doing a search via Schedule Board for that requirement, i am getting the correct contractor but same not happening via API.
I couldn't find much on this API except two blogs on ms site.
Will you be able to help further and make me understand the whole process?
Please, can you try this with a resource created two days ago? I think that is a Microsoft generally incident because I have the same issue in my environments.
Thanks!
Would you give us the snapshot of your code?
That would help us to help you better.
Have you tried putting the constraints at the right locations in the code?
So that they return the right values.
Hi,
Here's the code I am using..
dotnetfiddle.net/fXfAVW
SettingsEntity["MovePastStartDateToCurrentDate"] = false;
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Jump in, show your community spirit, and win prizes!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Abhilash Warrier 51 Super User 2026 Season 1
James White 21
FSRon 21