Use SQL stored procedures to create unattended tasks.
Challenge: a customer with 5 remote shipping locations needed packing slips produced automatically from 3 different order, invoicing and shipping systems, with tracking numbers on each, around the clock, Monday through Friday.
The requirements
- Produce packing slips automatically, with tracking numbers retrieved and printed on the document.
- Separate each batch immediately, group it, and send it to each remote shipping location.
- Email or text the customer and the account's salesperson an advance shipment notification.
- Do it all with no user intervention, 24 hours a day, Monday through Friday.
The solution: two scripts
A custom Crystal Reports packing slip pulls data from all three systems through a temporary print table. A SQL stored procedure checks open orders for anything ready to ship and fills that table.
The first script generates the packing slips and sends the output back to the EDD <Standard Processing Queue>. The second script picks it up, parses it and distributes it.
Script 1: find orders and print packing slips
It is a scheduled action that runs every 30 minutes, all day, every weekday. Each line runs as soon as the one before it finishes.
- Line 1: calls their SQL stored procedure to select orders ready to ship. If it finds any, the procedure calls their in-house UPS program to get tracking numbers and assign them to each order.
- Line 2: runs the Crystal Report and prints straight into EDD's <Standard Processing Queue> for immediate distribution.
Line 1 uses the Execute SQL Statement action. The SQL tab holds the data source, user ID, password, stored procedure name and any arguments.
Line 2 uses the Run Crystal Reports action. The Crystal Reports tab holds the report file and path, user ID, password and any parameters. The destination is the <Standard Processing Queue>.
Script 2: distribute the packing slips
As soon as the output arrives, the Distribute Packing Slip script runs.
- Burst the packing slips by document ID and archive a copy.
- Regroup them by shipping location, and send each location its slips by email, fax or printer, as that location prefers.
- Email or text the account's salesperson that the order is shipping.
- Email the customer a shipment notification.
Both scripts run without user intervention, within seconds of each other.






