# How to Create a BPM Method Directive in Epicor Kinetic

> Source: https://netray.co/erp-help/epicor-bpm-method-directive-how-to-create
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

In Epicor Kinetic, open Business Process Management > Method Directive Maintenance (the BPM Workbench), pick the business object and method, choose Pre-Processing, Base Processing or Post-Processing, then add a condition and actions such as Show Message or Set Field. Enable it and test in a pilot company before production.

## Kind

how-to

## System

epicor

## Erp

Epicor Kinetic

## Module

Business Process Management

## Query

how to create a BPM method directive in Epicor

## Alternate Queries

- Epicor BPM pre-processing vs post-processing
- Epicor Kinetic BPM Workbench tutorial
- Epicor method directive condition widget action
- Epicor BPM show message example

## Applies To

Epicor Kinetic 2021.x to current and Epicor ERP 10.2.x; Method, Data and Function directives (this page covers Method directives)

## Steps

### Create and deploy a Method Directive

**Items:**

- Open System Management > Business Process Management > Directive Maintenance (BPM Workbench) and choose New Method Directive.
- Select the business object and method. For example, Erp.BO.JobEntry and Update to act when a job is saved, or Erp.BO.SalesOrder and Update for order changes.
- Choose when it runs. Pre-Processing runs before the method and can stop or alter the data. Post-Processing runs after the standard logic. Base Processing replaces nothing but sits around the standard step.
- Add a Condition widget. Use Condition (Where the data or the changed row meets a test) such as 'Number of rows in ttJobHead where JobEngineered is changing to true is at least 1'.
- Attach an Action to the true branch: Show Message (warning or error), Set Field, Send Email, or Invoke BO Method. Use Raise Exception to block the save.
- Save, then Validate the directive. Fix syntax errors in any custom code widget flagged by the validator.
- Tick Enabled, deploy to a pilot or test company first, and run the real screen action to confirm behaviour.
- Check the Tracker or the BPM log for runtime exceptions, then promote to production through your normal change control.

## Sections

### Pre, base or post: choosing the right point

**Body:**

The most common beginner mistake is putting logic at the wrong point. Pre-Processing sees the incoming data in temporary tables (ttJobHead style) before Epicor validates and writes it. Use it to validate input, default fields, or block a save with a clear message.

Post-Processing runs after the standard method succeeds. Use it for side effects: sending an email, writing to a UD table, creating a related record, or calling an external API. If a post-processing action fails, the standard change may already be done, so write defensively.

A Data Directive (In-Transaction) is a different type that runs inside the database transaction on table-level changes. Use it when you must guarantee the extra change commits or rolls back with the main one. Method Directives are easier to debug; Data Directives are safer when atomicity matters.

### Conditions and actions that cover most requests

**Body:**

Most requests fall into a small set. Block a save when a field is blank: Pre-Processing, condition on the temp table row, action Raise Exception with a clear message. Default a field: Pre-Processing, Set Field. Notify on a status change: Post-Processing, condition comparing the new value to the original, action Send Email.

To compare old and new values, use the condition option that tests the changed row against the original row in the dataset. That avoids firing on every save, which is the number one cause of noisy directives and slow screens.

Keep each directive to one purpose and give it a descriptive name with the method in it. Large directives that do five jobs are hard to disable when something goes wrong.

### Custom code widgets and what to keep out of them

**Body:**

A Custom Code action lets you write C# against the dataset. It is powerful, but it is where upgrades and performance problems start. Prefer standard widgets and Epicor Functions for reusable logic, and call them from the directive.

Never run long external calls in Pre-Processing. The user is waiting on the screen and the transaction is open. Push slow work to Post-Processing, or to a Function that queues the work, and handle timeouts.

**Code:**

// Custom code snippet in a Pre-Processing directive (read the row, block on rule)
foreach (var row in ttJobHead.Where(r => r.RowMod == "U" || r.RowMod == "A"))
{
    if (row.JobEngineered && string.IsNullOrWhiteSpace(row.PartNum))
    {
        this.PublishInfoMessage("A part number is required to engineer a job.", Ice.Common.BusinessObjectMessageType.Error, Ice.Bpm.InfoMessageDisplayMode.Individual, "JobHead", "PartNum");
    }
}

### Testing, logging and rollback

**Body:**

Test with the real screen action in a test company, not only the Validate button. Validation proves the syntax, not the behaviour. Watch for the message text, the data effect and the time the save takes with and without the directive enabled.

Keep a record of what is deployed. Directives can be exported and imported between environments, which is how you promote them. Disable rather than delete when you back out a change, so the history stays.

## Pitfalls

- Creating a Pre-Processing directive that fires on every save because the condition does not compare old and new values.
- Doing slow web calls or heavy queries inside Pre-Processing while the user waits and the transaction is open.
- Editing the directive directly in production without exporting a copy first.
- Raising an exception in Post-Processing and expecting the standard change to roll back; it may already be committed.
- Writing the same rule twice, once in a directive and once in a UI customization, so they disagree after an upgrade.

## Ai Angle

An assistant grounded in your Epicor environment can read your existing directives, find the ones that touch a given business object, and draft the condition and action for a new rule for a developer to review. It can also explain a directive's message when users report one. It should not enable or deploy directives itself; that stays with the developer and the change process.

## Faq

### What is the difference between a Method Directive and a Data Directive in Epicor?

**Answer:** A Method Directive attaches to a business object method such as Update and runs before, after or around it. A Data Directive attaches to a table and runs inside the database transaction on add, change or delete. Use a Method Directive for validation and messages; use a Data Directive when the change must commit together.

### How do I stop a save with a message in Epicor BPM?

**Answer:** Use a Pre-Processing Method Directive on the business object Update method, add a condition that detects the bad data, and add a Raise Exception action or Show Message set to Error. The save is cancelled and the user sees the text. Make the message state what to fix.

### Where do I see BPM errors in Epicor Kinetic?

**Answer:** Errors appear to the user as a dialog and in the server logs. Administrators can review them in the Server log of the application server or through the Tracker and BPM logging options. Enable detailed logging only briefly, since it adds overhead to busy business objects.

### Do BPM directives survive an Epicor upgrade?

**Answer:** Standard directives are stored in the database and carry over, but any custom code can break if the business object or dataset changed. Always revalidate and retest each directive in a test environment after an upgrade, starting with those using custom code widgets.

## Search terms

epicor bpm method directive, epicor bpm workbench, epicor pre-processing post-processing, epicor kinetic bpm tutorial, epicor bpm show message, epicor raise exception bpm, epicor data directive vs method directive, epicor bpm custom code, epicor directive maintenance

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
