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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

msdyn_SearchResourceAvailability implement in plugin

(0) ShareShare
ReportReport
Posted on by 5

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. 

I have the same question (0)
  • erhan.keskin Profile Picture
    2,253 on at

    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,

  • Aashish Baral51 Profile Picture
    5 on at

    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

  • erhan.keskin Profile Picture
    2,253 on at

    Is it just in the plugin you see 0 total available time?

    How is it seen in the resource scheduling?

    community.dynamics.com/.../how-to-sort-results-by-total-available-time-when-searching-for-resource-availability

    cloudblogs.microsoft.com/.../

  • eromerof Profile Picture
    104 on at

    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!

  • eromerof Profile Picture
    104 on at

    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);

  • Aashish Baral51 Profile Picture
    5 on at

    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);

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans