As we have stated previously, Epicor has provided customers with a simple method for building business rules into the ERP workflow without the usual upgrade headaches that go along with customizations. They call it Business Process Management (BPM). BPM comes in two flavors, Method Directives and Data Directives. Data Directives are fired by updates to a table. Method Directives are called before, during, or after a Business Object Method executes. Today we want to demonstrate how to perform a common validation using a BPM Method Directive.
Here is a common problem. Business to business sales order entry can cause headaches and heartburn in accounts receivable when duplicate purchase orders occur. Duplicate purchase orders can be easily prevented by validation at order entry time with a warning to users. Some businesses will want to prevent duplicate PO numbers altogether and some will just want to warn the user. Either way, the validation is a simple one.
In Epicor, the best way to accomplish this is to create a Method Directive. We will select a Business Object and Method, and then build our condition and action:
- We will choose the SalesOrder object and the Update method.
- Our condition will use an ABL query to determine whether multiple Sales Orders have the same PO number as the one being updated.
- Our action will pop up a simple message box, warning the user of the potential problem.
- 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.
Some business process solutions are just that simple, and others are more complex. Either way, Method Directives are the Multi-Tool of Epicor customization. They will often get the job done. If you need help solving simple or complex business needs with elegant solutions, we at Deft Flux care about getting the job done right. Give us a call or e-mail us using the contact page.