Open the Method Directives application (in the standard Epicor menu — Main Menu >> System Management >> Business Process Management >> Setup >> Method Directives).

Click the “Method Code” button to open the search window, and search for the Method Name starting at “Update” and the Business Object “SalesOrder.” Select the “Update” method.

From the menu or toolbar, select File >> New >> New Pre-Processing.

Give your directive the name “Check for Duplicate PO,” and check the “Enabled” and “Prevent Endless Loops” check boxes.

Click the “Conditions” button and then the “Add Line” button.

Under “User Text” select “number of rows in the designed query…”.

Click the “designed query” hyperlink and then give the query a name — “DupPO”, type in the query “for each ttOrderHed no-lock , each OrderHed no-lock where (OrderHed.CustNum = ttOrderHed.CustNum and OrderHed.PONum = ttOrderHed.PONum and OrderHed.OrderNum <> ttOrderHed.OrderNum )” and then click “OK.”

Leave the “is not less than 1″ portion of the condition as is, and click “OK.”

Click the “Actions” button and then the “Add Line” button.

Select the “show informational message based on the designed template” option.

Click the “designed” hyperlink, and enter the name, severity, and message text.

If you want to show the PO number the user entered, click “Insert” and enter the name “PONum”, select the proper table “ttOrderHed”, check all the boxes, and check the “PONum” field name. Click OK.

As soon as you save your work, the Method Directive will be called anytime and anywhere the SalesOrder.Update method is called.
