Requirement
Blueleaf needs to convert the real time script for 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.
Deliverables
Scenario 1
We will deploy a workflow action script in the Sales Order record, which will call a map reduce script to mark the ‘Export to On Demand’ checkbox in during the creation process and when undergoing the approval process by either clicking on the ‘approve’ button or during bulk approval processing.
If multiple orders are created simultaneously and are not processed in real-time, these orders will be stored in a custom record. The unprocessed data will then be handled by the same scheduled script with a time interval of 15 minutes.
Case 1
- 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 by checking the quantity Committed values from line level.
- If the sales order contains only inventory items and includes any line-level items such as a non-inventory item, a drop-ship item, or a special-order item.
- The orders will be flagged by checking the checkbox ‘Is Processed’ to exclude them from scheduled script processing if it is completely processed.
Case 2
- When the 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)
- If all the line items are committed by checking the quantity Committed values from line level.
- If the sales order is processed completely then flag the sales order by checking the “Is Processed” checkbox.
Assumptions and Limitations
- We will not consider the orders to check the check box “Export to On Demand” if the Ship Complete check box is either manually checked once the order is processed for fulfilment process.
- Historical data is not considered.
- When the back-ordered items are committed these sales orders will be considered in the scheduled script until all the lines are processed.
- When the ‘Ship Complete’ checkbox is checked and the sales orders have either back-ordered items or all items are committed then the sales order is considered only after all the lines are committed within the scheduled script.
- We will consider sales orders created 60 days from the current date.
- If a sales order contains only inventory items and neither a dropship nor a special-order item, and it is created with a ‘Pending Approval’ status, the checkbox will be checked upon approving the sales order record if any of the items are committed.
- Make a copy context and Inline edit is not considered in this scenario to check the Export to On Demand check box.
- When scheduling map-reduce scripts, certain scenarios may arise, such as missing processing records or processing the same data multiple times, if the scheduled script is waiting in the queue for execution.