You've highlighted a common point of confusion with how Work Order and Booking statuses interact in Dynamics 365 Field Service, especially with multi-day Work Orders. Let's break down why you're seeing this behavior and how to achieve your desired outcome.
Understanding the Interaction of WO Status and Booking Status:
- Work Order Status: Represents the overall state of the entire work order (e.g., Open, In Progress, Completed, Canceled).
- Booking Status: Represents the status of a specific technician's booking (time slot) on the work order (e.g., Scheduled, Traveling, In Progress, Completed, Finished Need Parts, WO Completed).
Why Your Expectation Isn't Being Met (and the Explanation of the Behavior):
- WO Status Remains "In Progress": The Work Order Status is designed to reflect the overall completion of all the work required on that order. Even if one booking reaches a "WO Completed" status, the Work Order itself might still have other active or incomplete bookings. The system, by default, waits for all relevant work (typically indicated by at least one booking reaching a "Completes Work Order" status) before automatically setting the Work Order to "Completed."
- Changing End Date/Time of the First Day Booking: This is the more critical issue. When you manually changed the Work Order Status to "Completed" after the second booking with "WO Completed," the system likely tried to finalize the entire Work Order. Part of this finalization process involves setting the actual end times for all associated bookings. Since the first day's booking was marked as "Finished Need Return," the system might have incorrectly assumed that the "Completed" status of the overall Work Order implies that all work on that booking is now considered finished at the time of Work Order completion.
How to Achieve Your Desired Outcome (Setting WO Status to Completed Automatically):
To automatically set the Work Order Status to "Completed" when any booking on that Work Order reaches the "WO Completed" status, you'll need to adjust the system's configuration. Here's the recommended approach:
1. Configure the "WO Completed" Booking Status:
- You've already mentioned that "WO Completed" has "Status Completes Work Order" set to ON. This is correct and the fundamental setting for triggering the Work Order completion.
2. Review System Settings for Work Order Completion:
- Navigate to Field Service > Administration > Field Service Settings.
- Look for settings related to Work Order Completion.
- "Auto Close Work Order Completed From Schedule": This setting, if set to Yes, will automatically close a Work Order when the last booking on it is set to a status that has "Status Completes Work Order" set to Yes.
- Consider this setting: If your workflow always involves the "WO Completed" status being the final booking status on a multi-day WO, enabling this might work. However, if there's a chance of other bookings remaining in a non-final status, this might close the WO prematurely.
3. Implement a Workflow (Recommended and More Flexible):
A Real-time Workflow is the most flexible and reliable way to achieve your specific requirement:
- Go to Settings > Processes > + New.
- Process Name: Set a descriptive name (e.g., "Auto Complete WO on WO Completed Booking").
- Category: Workflow.
- Entity: Booking (Bookable Resource Booking).
- Run this workflow in the background (recommended): Uncheck this initially for testing, but enable it for production.
- Click OK.
Workflow Steps:
- Start when: Record is created, Record status changes.
- Check the "Record is created" option.
- Check the "Record status changes" option.
- Add a "Check Condition":
- (Booking (Status)) equals (WO Completed) - Select the "Booking Status" field and check if it equals your "WO Completed" status.
- Add a "Check Condition":
- (Booking (Work Order)) does not equal (null) - Ensure there's a related Work Order.
- Add an "Update Record" step:
- Entity: Work Order (regarding).
- Click Set Properties:
-
- Set the Work Order Status field to Completed.
- You might also want to set the System Status (msdyn_systemstatus) to Completed.
- Important: Do NOT directly manipulate the end date/time of other bookings in this workflow. The issue you experienced with the first day's booking was likely due to a manual Work Order status change. The system should handle the end times of individual bookings based on their own status transitions.
- Click Save and Close.
- Save and Activate the Workflow.
Explanation of the Workflow:
This workflow will trigger whenever a Booking record's status changes to "WO Completed." It then checks if there's a related Work Order and, if so, updates the Work Order's status to "Completed."
Addressing the End Date/Time Issue:
The issue of the first day's booking end date/time changing to "NOW" when you manually set the Work Order to "Completed" after the fact suggests that the system's built-in Work Order completion logic might be trying to finalize all associated bookings.
To avoid this unintended change:
- Rely on the automated workflow: Once you have the workflow in place, the Work Order status should change to "Completed" automatically when the "WO Completed" booking occurs. You shouldn't need to manually change the Work Order status.
- Review any other plugins or workflows: Check if you have any other custom plugins or workflows that might be interfering with the Work Order or Booking status updates and potentially modifying booking end times.
In summary, configure your "WO Completed" booking status correctly (which you have), and then implement a Real-time Workflow that triggers on the "WO Completed" booking status to automatically update the related Work Order status to "Completed." Avoid manually changing the Work Order status after a "WO Completed" booking has occurred to prevent the unintended modification of previous booking end dates/times.