web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

URS message msdyn_searchresourceaavailablity not working

(3) ShareShare
ReportReport
Posted on by 8

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.

I have the same question (0)
  • eromerof Profile Picture
    104 on at

    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

  • nkhemji Profile Picture
    8 on at

    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?

  • eromerof Profile Picture
    104 on at

    Hi dyn365,

    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!

  • CJustin Profile Picture
    262 on at

    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.

  • nkhemji Profile Picture
    8 on at

    Hi,

    Here's the code I am using..

    dotnetfiddle.net/fXfAVW

  • Suggested answer
    AT-01061228-0 Profile Picture
    3 on at
    It appear that, the docs are misleading, as the actual request does the opposite of the Settings name would suggest. 
     
    SettingsEntity["MovePastStartDateToCurrentDate"] = false;

    This will move a past msdyn_fromdate on the ResourceRequirement to the current date, which is also the default behaviour.

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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 51 Super User 2026 Season 1

#2
James White Profile Picture

James White 21

#2
FSRon Profile Picture

FSRon 21

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans