# Epicor BPM: Update a UD Field, a PO Cost or a Table, and Update vs UpdateExt

> Source: https://netray.co/erp-help/epicor-bpm-update-ud-field-update-vs-updateext
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

From a BPM you can update data three ways: change the incoming temp table row (best for the record being saved), call a business object Update or UpdateExt on another record, or write through Db and call Validate. UpdateExt returns errors in the dataset instead of throwing. A record in process error means the record is already being saved in the same call chain.

## Kind

how-to

## System

epicor

## Erp

Epicor Kinetic

## Module

BPM / Updating Data

## Query

epicor bpm update ud field

## Alternate Queries

- epicor bpm update table by query
- epicor bpm update purchase order cost
- epicor update vs updateext
- epicor record in process unable to update
- epicor bpm writeentry

## Applies To

Epicor Kinetic and 10.x. Use business object services for changes that must run business rules; direct Db writes bypass them.

## Steps

### How to update data from a BPM

**Items:**

- If the record is the one being saved, set the field on the ttTable row in a Pre or Post-Processing directive instead of calling another update.
- For a UD field, use the UD field helper on the row or the indexer with the column name, such as Character01.
- For another record, call the right business object: GetByID, change the row, set RowMod to U, then Update or UpdateExt.
- Prefer UpdateExt when you want to handle errors yourself, and check the returned error flag.
- For bulk changes, loop over a query result and call the service for each, in small batches.
- For a table with no service (such as a UD table), use Db, change the rows and call Db.Validate inside a transaction scope.
- Test with a record locked by another user to see the behaviour.

## Sections

### Updating a UD field and the incoming row

**Body:**

The cleanest update is on the data already in the call. In a Pre-Processing directive on SalesOrder.Update the header is in ttOrderHed, so setting the UD column there saves it with the order, in the same transaction, with no second call. Filter rows by Added or Updated.

Writing a UD field on a different record needs a service call or Db. If a row is also in the dataset being saved, the saved values can overwrite what you wrote, so do not update the same record two ways.

**Code:**

- foreach (var hed in ttOrderHed.Where(r => r.Added() || r.Updated()))
{
    hed["Character01"] = "Approved";
}

### Update vs UpdateExt, and updating a purchase order cost

**Body:**

Update(ref ds) throws a business object exception on the first validation error. UpdateExt(ref ds, out errorsOccurred) collects errors into the dataset error table and returns a flag, which suits bulk jobs where one bad record should not stop the rest. Use Update when you want failure to abort.

To change a PO line cost, load the PO with the PO service, change the unit cost on the detail row, set RowMod to U, and call Update. Respect the PO's release or approval state, because the service will reject changes to a closed or approved line. Never write cost columns directly with Db if you need the system to recalculate totals and approvals.

**Code:**

bool errors;
this.CallService<Erp.Contracts.POSvc>(svc =>
{
    var ds = svc.GetByID(poNum);
    var line = ds.PODetail.FirstOrDefault(l => l.POLine == poLine);
    if (line != null)
    {
        line.RowMod = "U";
        line.DocUnitCost = newCost;
        svc.UpdateExt(ref ds, out errors);
    }
});

### Record in process, update by query, and logging

**Body:**

A record in process or unable to update message appears when your update targets a record already being saved in the same chain, or locked by another session. Fix by changing the incoming row instead, moving the update to a Standard post-processing directive that runs after the commit, or using an In-Transaction approach consistently. Do not retry in a loop.

Update by query means selecting a set with Db or a BAQ and then updating each through the service or Db. For logging what you did, writing to the Windows event log with EventLog.WriteEntry works on-prem but needs the event source to exist and permission, and is not available in cloud. A UD table log, or a PublishInfoMessage during testing, is safer.

## Pitfalls

- Calling Update on the same record you are already saving, causing recursion or record in process.
- Writing cost or status columns with Db and skipping business rules.
- Not setting RowMod to U, so the service ignores the change.
- Using Update in a loop where one error should not stop the batch.
- Relying on EventLog.WriteEntry in cloud tenants.

## Ai Angle

An assistant can review a BPM for the typical traps: a second update to the same record, a missing RowMod, a direct Db write to a business-rule table. It drafts and explains; your developer tests in a pilot company. Private on-prem models keep the code in-house.

## Faq

### What is the difference between Update and UpdateExt in Epicor?

**Answer:** Update throws an exception on error. UpdateExt returns an error flag and puts messages in the dataset, so your code can continue or handle them. UpdateExt suits batch work.

### How do I update a UD field from a BPM?

**Answer:** Set it on the ttTable row in the directive for the record being saved. For another record, load it through the service, change the UD column, set RowMod to U and call Update.

### Why do I get record in process or unable to update?

**Answer:** The record is already being saved in the same call, or is locked. Change the incoming row, move the update to a post-processing Standard directive, or avoid a second update of the same record.

### Can I update a table directly with Db?

**Answer:** Yes, for tables with no business rules such as UD tables. Use a transaction scope and call Db.Validate. For orders, POs and jobs use the service so rules run.

## Search terms

epicor bpm update ud field, epicor update vs updateext, epicor record in process unable to update, epicor bpm update purchase order cost, epicor bpm update table by query, epicor bpm writeentry, epicor updateext errors, epicor bpm callservice update

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