Trigger RSO on-demand from Flow and Code

This blog post focus on how to trigger an existing RSO Schedule that’s been set up. This post doesn’t cover setting up an RSO schedule, we will see that in a different post. Before jumping into the action, a quick introduction about RSO.

What is Resource Scheduling Optimization (RSO)?

It is an add-on capability for the Dynamics 365 Field Service application that enables organizations to automatically schedule work orders for the most appropriate resources. Organizations can optimize bookings to minimize travel time, maximize working hours, schedule the most qualified technician, and more, based on their configured objectives such as “minimize travel time” and “maximize working hours.”

Why do we need RSO?

We have the flexible Schedule Board which provides users to manually schedule the items by drag n drop and the powerful capabilities that Scheduling Assistant provides by identifying the qualified resources based on the criteria set in resource requirements, why do we need RSO then?

The challenge with both options is that it is almost impossible for individuals to manually schedule large quantities of work orders, that’s where RSO saves organizations. RSO is an automated scheduling solution that assists with these more complex scheduling scenarios and scheduling in large quantities.

Why do we need to trigger RSO on-demand?

Despite RSO offers such flexible scheduling and scoping rules, sometimes we might need to trigger RSO on certain events where don’t have the luxury to wait for the next RSO scheduled run to kick in. In these cases, either we can trigger the RSO automatically from Flow or through code. Please note that  optimization schedule should be already configured.

How to trigger from Flow/Code?

Inputs to this action

  • Schedule ID – GUID for the Optimization Schedule
  • OptimizationRequestType – ‘2’ (similar to ‘Run Now’ when done manually)

From the MS Flow, we can call an unbound action as below

From the code, call the action to trigger the RSO.

  var RSOScheduleId = "25a56c1f-81ee-eb11-94ef-000d3ac7d938";
  var request = new OrganizationRequest()
            RequestName = "msdyn_CreateScheduledOptimizationRequest",

 request["ScheduleId"] = RSOScheduleId;
 request["OptimizationRequestType"] = 2;
 OrganizationResponse slotResponses = service.Execute(request);

Hope this is useful, please leave your feedback in the comments!

2 thoughts on “Trigger RSO on-demand from Flow and Code

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s