Schedule MacroRIS-SM-2283 – Auto PO Creation & Email

Auto PO Creation & Email

Automate direct delivery order processing by validating suppliers, creating purchase orders, adding delivery details, emailing suppliers, and moving orders through workflow stages.

Overview

The RIS-SM-2283 – Auto PO Creation & Email macro streamlines direct delivery workflows by automatically generating purchase orders, sending them to suppliers, and updating order status.

Use this macro for direct delivery orders to ensure fast supplier communication and eliminate manual PO handling.

Purpose

This macro:

  • Validates supplier consistency across items

  • Creates purchase orders automatically

  • Adds delivery and customer details to PO

  • Sends PO to supplier via email

  • Moves orders to appropriate workflow folders

👉 In short:
Validate → create PO → add details → email → move order.

When It Runs

Typically executed:

  • After order import

  • For direct delivery orders

  • Before supplier fulfillment

  • During PO automation workflows

  • When supplier-based dispatch is required

  • Manually or via automation

Parameters

path
emailTemplatestring
Required

Email template used to send purchase orders to suppliers.

Simple Explanation

The macro processes direct delivery orders, validates suppliers, creates purchase orders with delivery details, emails them to suppliers, and updates order workflow status.

Step-by-Step Flow

Start Macro

Log execution start and initialize configuration.

Fetch Locations

Retrieve Direct Delivery warehouse/location.

Get Open Orders

Fetch all open orders for the selected location.

Filter Orders

Process only orders in the Direct Deliveries folder.

Loop Through Orders

Process each order individually.

Validate Suppliers

Ensure:

If validation fails → move to Manual Check folder.

Check Existing PO

If purchase order already exists → skip creation.

Create Purchase Order

Generate PO with:

Add Shipping Details to PO

Copy customer name, address, and contact details into PO notes.

Add Order Items

Add all items to PO:

Add Delivery SKU

Add additional SKU "Direct" using supplier cost.

Set PO Status

Set purchase order status to OPEN.

Send Email to Supplier

Send PO using configured email template:

If email fails → move order to Manual Check folder.

Move Processed Order

Remove from Direct Deliveries folder and move to PO Sent to Supplier.

Logging

Log processing steps, PO creation, email status, and errors.

Final Result

  • Purchase orders created automatically

  • Suppliers receive PO via email

  • Orders moved to processed folder

  • Failed orders routed for manual review

Usefulness

  • Full Automation – Eliminates manual PO creation

  • Supplier Accuracy – Ensures single supplier per order

  • Faster Processing – Instant PO generation and email

  • Error Handling – Routes problematic orders for review

  • Clean Workflow – Uses folders for tracking progress

Example Scenario

Key Insight

This macro follows a structured flow:
Validate Order → Check Supplier → Create PO → Send Email → Move Order.

It prevents wrong supplier assignment, duplicate PO creation, manual errors, missed communication, and unprocessed orders.