Requirement
Blueleaf needs to mark the Export to On Demand check box in Sales Order record based on the following criteria.
Criteria 1
When the Ship Complete checkbox is checked, the Sales order has the status as ‘Pending Fulfilment’ and the body level ‘Shipping Method has the value either VAN: Scheduled Delivery (Internal ID: 23) or VAN: Scheduled Delivery (E) (internal ID 22) or VAN: Scheduled Delivery – T3 (Internal ID 48185)
- When all the line items are fully committed in the sales order, then check the “Export to on-demand” checkbox.
Criteria 2:
When the Ship Complete checkbox is not checked, the Sales order has the statuses as Pending Fulfillment, Sales Order Partially Fulfilled or Sales Order Pending Billing/Partially Fulfilled and the body level ‘Shipping Method has the value either VAN: Scheduled Delivery (Internal ID: 23) or VAN: Scheduled Delivery (E) (internal ID 22) or VAN: Scheduled Delivery – T3 (Internal ID 48185)
Scenario 1
- When a sales order is created with Pending Fulfilment status and some items are committed and some items are back-ordered, then check the “Export to on-demand” checkbox.
Scenario 2
- When the sales order status is either Pending Fulfilment, Partially Fulfilled or Pending Billing/Partially Fulfilled and the back ordered items on the sales order are committed, then clear the values in the Route number, Truck number, Stop number, and Driver (2) fields and untick the “Exported to on-demand” box.
- Then check the “Export to on-demand” checkbox.
- Repeat scenario 2 until the sales order has the status Pending billing or Billed.
SOLUTION
Scenario 1
We will deploy a user script in the Sales Order record to mark the “Export to On Demand” check box based on the following criteria during the creation time.
Case 1
- Ship Complete check box is checked.
- The sales order has the status as ‘Pending Fulfilment’.
- The body level ‘Shipping Method has the value either VAN: Scheduled Delivery (Internal ID: 23) or VAN: Scheduled Delivery (E) (internal ID 22) or VAN: Scheduled Delivery – T3 (Internal ID 48185)
- All the line items are fully committed.
Case 2
- When the Ship Complete check box is unchecked
- The sales order has the status as ‘Pending Fulfilment’
- The body level ‘Shipping Method has the value either VAN: Scheduled Delivery (Internal ID: 23) or VAN: Scheduled Delivery (E) (internal ID 22) or VAN: Scheduled Delivery – T3 (Internal ID 48185)
- If any of the line items are committed.
Scenario 2
- We will deploy a scheduled script to mark the “Export to On Demand” checkbox and clear the values in the Route number, Truck number, Stop number, and Driver (2) fields and untick the “Exported to on-demand” box if any of the back ordered items are committed.
- The script is scheduled to execute every 2 hours which gets the sales orders if any back-ordered items are committed.
Case 1
Criteria
- When the Ship Complete check box is unchecked
- If the sales order has status either ‘Pending Fulfilment’, Partially Fulfilled or Pending Billing/Partially Fulfilled
- The body level ‘Shipping Method has the value either VAN: Scheduled Delivery (Internal ID: 23) or VAN: Scheduled Delivery (E) (internal ID 22) or VAN: Scheduled Delivery – T3 (Internal ID 48185)
- Any of the back-orders items are committed.
Outcome
- Then clear the values in the Route number, Truck number, Stop number, and Driver (2) fields
- untick the “Exported to on-demand” box.
- Then check the “Export to on-demand” checkbox.
- This process will be repeated until the sales order has the status Pending billing or Billed.
Case 2
Criteria
- When the Ship Complete check box is checked
- If the sales order has the status either ‘Pending Fulfilment’
- The body level ‘Shipping Method has the value either VAN: Scheduled Delivery (Internal ID: 23) or VAN: Scheduled Delivery (E) (internal ID 22) or VAN: Scheduled Delivery – T3 (Internal ID 48185)
- When all the line items are committed.
Outcome
- Then check the “Export to on-demand” checkbox.