Skip to content

A Custom Event set to Fire After a Shop Order status change reads a custom attribute based on a real-time API call (like SHOP_ORD_API.Get_Mtrl_State) to check the new material state, but the attribute keeps returning the OLD state instead of the state the record was just changed to.

Answer

This happens when the value you're reading isn't actually a stored column — it's computed live by querying the database at the moment it's called, and a BEFORE-commit event fires before the triggering change has actually been committed to the database, so that live query still sees the pre-change (old) state. Selecting 'Fire After' the object is changed controls when your event logic runs relative to the client's own in-memory change, not whether the underlying transaction has been committed to the database yet — a real-time computed API call inside the event will still reflect what's currently persisted, not the value about to be saved. If you need the actual new value inside the event, read it directly from the event's own NEW: substitution variables (or the record being modified) rather than calling a live-computed API function that re-queries the database.

← Browse Developer Studio, deployment, and upgrades questions