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.
  1. Open the Method Directives application (in the standard Epicor menu — Main Menu >> System Management >> Business Process Management >> Setup >> Method Directives).
    01-Method Directives
  2. 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.
    02-Method Search
  3. From the menu or toolbar, select File >> New >> New Pre-Processing.
    03-New Pre-Processing
  4. Give your directive the name “Check for Duplicate PO,” and check the “Enabled” and “Prevent Endless Loops” check boxes.
    04-New Method
  5. Click the “Conditions” button and then the “Add Line” button.
    05-New Condition
  6. Under “User Text” select “number of rows in the designed query…”.
    06-Designed Query
  7. 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.”
    07-DupPO query
  8. Leave the “is not less than 1” portion of the condition as is, and click “OK.”
    08-Completed Condition
  9. Click the “Actions” button and then the “Add Line” button.
    09-Add Action
  10. Select the “show informational message based on the designed template” option.
    10-New Action
  11. Click the “designed” hyperlink, and enter the name, severity, and message text.
    11-Informational Message
  12. 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.
    12-Select Table Fields
  13. As soon as you save your work, the Method Directive will be called anytime and anywhere the SalesOrder.Update method is called.
    13-Informational Message

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.