How-toEpicor KineticBusiness Activity Queries (BAQ)

How to Create a BAQ in Epicor Kinetic

Question
how to create a baq in epicor kinetic

Also searched as

  • epicor kinetic query builder
  • epicor baq tutorial
  • build a business activity query epicor

Short answer

A BAQ (Business Activity Query) is a saved query in Epicor Kinetic that you build in the Query Builder without writing SQL. Choose the tables, define joins, select display fields, add criteria and calculated fields, test the result, then use the BAQ in dashboards, reports, BPMs or the REST API.

Applies to: Epicor Kinetic (and recent Epicor ERP 10 releases). Menu paths and tab names vary slightly by version, search the menu for Query Builder or BAQ.

Build your first BAQ

  1. 1Open the Query Builder (use the menu search for Query Builder or Business Activity Query) and click New.
  2. 2Give the query an ID and description, choose its scope (company or system) and whether it is shared.
  3. 3On the Phrase Build or table area, add the tables you need, starting with the main table such as JobHead or OrderHed.
  4. 4Add related tables and set the joins, being careful to use inner joins only when a match is required and left outer joins otherwise.
  5. 5On the Display Fields area, select the fields to show, set column labels and ordering.
  6. 6Add criteria on table fields (for example open jobs only) and consider parameters if the user should be asked.
  7. 7Add calculated fields where needed, for example a margin or an age expression.
  8. 8Analyze and test the query, fix errors, then save and generate it.
  9. 9Use it in a dashboard, a BAQ Report, a BPM, a function or the REST API.

Design choices that matter

Start from the table at the grain you want in each row. If you want one row per job operation, start from JobOper, not JobHead. Joining upward to headers is cheap, joining downward multiplies rows and can inflate totals.

Filter as early as possible with table criteria rather than relying on a dashboard grid filter. A BAQ that pulls every historical row and filters on screen will be slow and put load on the database. Our page on slow BAQs goes through this.

Calculated fields and parameters

Calculated fields use an expression language that is close to SQL, built from fields in the query. Keep them simple and avoid heavy logic that belongs in a function. For user prompts, define a criteria value as a parameter in the query so dashboards and reports can ask for it.

Test with realistic parameters. A BAQ that works with one job can behave differently over a year of data.

Publishing and security

A BAQ is available to users who have access through its security settings, and a menu or dashboard may be needed to expose it. Treat BAQs that expose cost or pricing data like any other sensitive screen, and check company scope in multi-company installations.

Where you need the same data programmatically, the BAQ can be called through the REST API or from a function, which is covered in our Epicor function pages.

Try it here, free

Epicor BAQ Calculated Field Examples Reference

Open full tool

A searchable cheat sheet of BAQ calculated field expressions you can copy into the Query Builder, grouped by dates, quantities, pricing and text.

Common pitfalls

  • !Starting from the wrong table and getting duplicated rows or inflated totals.
  • !Using inner joins where optional data exists, silently dropping rows.
  • !Skipping criteria and pulling years of history into a dashboard.
  • !Forgetting to regenerate the BAQ after changes, so users see the old definition.

How an ERP-grounded AI assistant handles this

A grounded assistant can draft the table and join choices for a BAQ from a plain-language request, and explain an existing BAQ to a new analyst. Netray's ERPray can also answer many ad hoc questions without anyone building a BAQ, read-only against your Epicor data, including on-prem.

Frequently asked questions

What is a BAQ in Epicor?

A Business Activity Query is a saved query built in the Query Builder. It selects data from Epicor tables and can be used in dashboards, reports, BPMs, functions and the REST API.

Do I need SQL to create a BAQ?

No. The Query Builder is visual. Knowing the table structure and basic join logic helps, and SQL-like expressions are used in calculated fields.

Can a BAQ update data?

Updatable BAQs exist and can write to certain tables, but they bypass some business logic, so use them sparingly and with care.

Why is my BAQ slow?

Usually missing criteria, joins that multiply rows, or heavy calculated fields. Narrow the data early and test with production-sized data.

Related

How-to

Fixing a Slow Epicor BAQ (Business Activity Query)

A slow BAQ in Epicor is usually caused by unindexed join columns, a subquery or calculated field forcing a table scan, or the BAQ pulling far more rows than the dashboard actually displays before filtering client-side. Fix it by reading the SQL Server execution plan Epicor generates, moving filters into the BAQ criteria instead of the dashboard filter panel, and replacing subqueries with joins where possible.

How-to

How to Add a Calculated Field in an Epicor BAQ

In Epicor Query Builder, open the Phrase Build or Calculated Fields area of the Analyze tab or Display Fields, add a new calculated field with a name and a data type, and write a SQL expression that references columns as Table_Column. Guard against NULL and zero divisors, and use a subquery when the value needs its own aggregation.

How-to

Epicor Function: How to Call a BAQ from C# (Functions and BPM)

To run a BAQ from an Epicor Function or a BPM code block, call the Dynamic Query service: get the query's execution parameters by BAQ ID, set any parameter values, run it with the execute-by-ID method, and read rows from the results table. Declare the service in the function so the platform can resolve it.

How-to

How to build a Kinetic homepage dashboard in Epicor

Kinetic homepage dashboards are built from Active Homepage Maintenance: create a BAQ that returns the metric or list you want, add a KPI or List widget referencing that BAQ, arrange widgets on the homepage layout, and assign the homepage to a role or company so the right users see it.

Error fix

Fixing Epicor BusinessObjectException: BPM Directive Errors

A BusinessObjectException that says "A Business Process Management (BPM) directive has raised the following error" means a directive on that business object stopped the transaction, either deliberately via a Raise Exception widget or accidentally via an unhandled .NET error in Custom Code. Expand the InnerException on the error dialog to see the real message and the directive name, then open BPM Designer for that object and method to find the widget that fired.

How-to

Epicor MRP Runs but Generates No Suggestions

When Epicor's MRP process completes without a job or purchase suggestion for a part you expect one for, the cause is almost always the part's own configuration (Part Class Type, Make Direct, Non-MRP flag, planning Time Fence) or the demand not being linked in a way MRP recognizes, not a defect in the MRP engine. Work through the part's Planning tab, its safety stock and lead time setup, and the demand source (sales order line status, job material requirement) before assuming the run itself failed.

AI for ERP

AI for Epicor Kinetic, Beyond What Prism Covers

Add AI to Epicor Kinetic beyond Prism: private LLM over BAQs, BPM data, and REST v2, on-prem or private cloud, with honest guidance on when Prism already covers you.

Stuck on Epicor Kinetic?

Talk to engineers who work inside Epicor Kinetic every week, and who build private AI that answers these questions from your own ERP data.

Keep exploring

Free tools

ERP fixes and how-tos

AI on your ERP

Integrations

Comparisons

Software