Executing Scheduled Orders - ChristinaDos/Scheduled-Orders GitHub Wiki

On this page, you can find the analysis of how the scheduled orders are executed automatically and manually as well as how the automatic re-execution functionality operates.

Automatic Execution of Scheduled Orders

Once you complete the checkout process for a scheduled order, the following actions take place:

  1. Automatic Admission: Your scheduled order is immediately admitted to our system without any manual intervention required.

  2. Instant Confirmation: A “Storefront Order Confirmation” email is automatically sent to your designated contact, letting them know the order has been received.

  3. Pending Execution: The order receives a ‘Scheduled’ status and waits for its predefined execution date.

  4. Timely Processing: In the early hours of the scheduled date, our billing service retrieves and prepares the order for execution.

  5. Up-to-Date Pricing: The system recalculates item prices based on the latest available data, ensuring you get the most current pricing.

  6. Credit Check: Before execution, the system verifies if there’s enough available credit (for customers with set credit limits). If not, an email notification is sent, and the order remains ‘Scheduled’.

  7. Order Execution: Once all checks are passed, the order status updates to ‘Executing’ and the actual processing begins.

  8. Successful Completion: The order status changes to ‘Executed’ upon successful processing. Any associated subscriptions or assets are created automatically.

  9. Service Provisioning: Automatically-provisioned services and add-ons are activated.

  10. Invoice Generation: Debit invoices are created either immediately or as per your billing schedule.

  11. Final Notification: A “Scheduled Order Execution Successfully Completed” email is sent, confirming the order’s successful execution.

Manual Execution of Scheduled Orders

There are two main cases where a user would wish to manually execute a scheduled order.

  • Addressing Failed Automatic Execution Sometimes, an order may fail to execute automatically. This could happen due to various reasons such as:
    • API Call Failures: If there is an issue during the automatic retrieval of prices from an external system, the failure is logged in the History Records with a message like “The scheduled order has failed to be processed”.

    • Credit Limit Exceeded: If the available credit limit is reached or exceeded, an entry is made in the History Records stating “The execution of the scheduled order has failed”.

In these cases, manual execution becomes the only way to process the order after resolving the issue.

  • Early Execution Needs There might be instances where you need an order to be executed before its scheduled date. Whether it’s due to a change in customer requirements or business needs, you can manually trigger the execution of a scheduled order. To execute manually a Scheduled Order, navigate to the order’s view page and click on the ‘Execute Order’ button located under the Shortcuts menu.

⚠️ Credit Limit Bypass: When you manually execute an order, the system bypasses the credit limit check. This means it will not verify if the accounts have reached or exceeded their available credit limit.

Automatic Re-Execution of Failed Scheduled Orders

All scheduled orders that failed to be executed due to an issue with external pricing in their order item(s), enter a list that makes them available for automatic re-execution within the same execution date of the scheduled order to retry to retrieve the external pricing information. Thus, a new scheduled job runs every day and, at specified intervals within that day, it gathers all the failed scheduled orders before trying to re-execute them automatically, provided that they have not been executed successfully manually before and that the current date of the re-execution is the same day as the execution date (converted to the running machine’s date and time).

How a Scheduled Order Enters the Re-Execution List

Sometimes, scheduled orders encounter issues due to external pricing errors. This means that one or more items in the order did not successfully retrieve their prices from an external system. When this happens, the failed order is automatically forwarded to a re-execution list. This list is also accessible to Tenant resellers, ensuring that everyone in your supply chain can benefit from this feature.

Retry Scheduled Order Job

The Retry Scheduled Order Job, ensures that any failed scheduled orders are re-executed seamlessly, minimizing disruption and maximizing operational efficiency.

Retry Scheduled Order Job - Example (with different timezones between the hosted server and the organization):

  • Initial Start: The service kicks off every day at 6:00 am (server time).
  • Frequent Intervals: It runs every 6 hours, ensuring multiple attempts to re-execute failed orders.
  • Custom Time Threshold: The service operates until a default time threshold of 7:00 pm (organization’s timezone).

This continuous monitoring and retry mechanism means that even if an order fails initially, it gets several chances to succeed, ensuring minimal delays and interruptions.

Retry Scheduled Order Job Flow

  1. Searching the Retry List/Table: The job scans the re-execution list for scheduled orders that encountered external pricing errors. This ensures no order is left behind due to technical glitches.
  2. Checking Order Status:
    • Order In Progress: The job verifies if the order is still marked as “In Progress”. If not, it means the order status has changed to “Completed” or “Elapsed”, and it won’t be retried.
    • Order Scheduled: The job confirms that the order status is still “Scheduled”. If the status has changed (e.g., manually executed or canceled), the order is skipped for re-execution.
  3. Validating Order Items: The job checks if the order still contains at least one item with an external pricing error. If no errors remain, the status is updated to “Completed”, and the order isn’t retried.
  4. Ensuring Timeliness: The current date is compared to the order’s execution date. If the current date is later, the status is set to “Elapsed”, and the order won’t be retried.
  5. Creating a History Record: For transparency and record-keeping, a new retry history record is created for each attempt, providing a clear audit trail of all retry activities.
  6. Credit Control Check and Order Execution: The job performs a credit control check and proceeds to re-execute the order, aiming to overcome the initial external pricing error.
  7. Notification Emails:
    • Success: If the retry is successful, the primary contact receives a “Scheduled Order Execution Successfully Completed” email.
    • Failure: If the retry fails, a “Scheduled Order Execution Failed” email is sent at the last execution attempt, ensuring you are always informed about the status of your orders.