Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Unanswered

msdyn_SearchResourceAvailability implement in plugin

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. 

  • Aashish Baral51 Profile Picture
    Aashish Baral51 5 on at
    RE: msdyn_SearchResourceAvailability implement in 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);

  • eromerof Profile Picture
    eromerof 98 on at
    RE: msdyn_SearchResourceAvailability implement in plugin

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

  • eromerof Profile Picture
    eromerof 98 on at
    RE: msdyn_SearchResourceAvailability implement in plugin

    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!

  • erhan.keskin Profile Picture
    erhan.keskin 2,247 on at
    RE: msdyn_SearchResourceAvailability implement in plugin

    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/.../

  • Aashish Baral51 Profile Picture
    Aashish Baral51 5 on at
    RE: msdyn_SearchResourceAvailability implement in plugin

    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
    erhan.keskin 2,247 on at
    RE: msdyn_SearchResourceAvailability implement in plugin

    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,

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans