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.

Has anyone tried to use this for Epicor 10? I could use this, if it worked but the conditions is where I am getting stuck.
ReplyDeleteGreat solution!
ReplyDeleteThe step-by-step approach to checking for duplicate purchase orders in sales orders using ABL code is incredibly useful. It's a common issue, and your method offers a clear and efficient way to manage it within the system. Thanks for sharing such valuable insights!
epicforcetech