2026-11-27

Sage 100 User Defined Script Events

Every Sage 100 user-defined script event — table, column, and panel events explained — plus the honest answer on showing a dynamic value without a UDF.

User-defined scripting in Sage 100 Custom Office lets you attach your own business rules to a business object — but only at the trigger points Sage exposes. Pick the wrong event and the script fires too early, too late, or not at all. This page lists every documented event, what it does, and when to use it.

One prerequisite before any of it runs: in Company Maintenance, the Allow External Access check box must be selected, or user-defined scripting is disabled for that company.

Honest starting point: there is no confirmed published resolution for the specific request behind this page — showing a value that a script calculates when a record loads, for display only, without storing it in a user-defined field and without the record being treated as changed. The event catalogue below is documented Sage help material. The workarounds further down are explicitly unconfirmed practice suggestions, the dead ends are documented, and the escalation path is at the end of that section. Do not read anything on this page as a confirmed fix for the display-value problem itself.

The fix

Table events

Attach these to a table in User-Defined Script Maintenance when the rule concerns the record as a whole:

  1. Script Initialization — fires when scripting is first initialized for a business object. Use it to set up values the object will need for its whole lifetime.
  2. Set Defaults — fires when defaults are set for a new record. Use it when factory defaults are not enough.
  3. Pre-Write — fires before a record is written, and it can prevent the write. This is the last-chance validation point: check the whole record here and stop the save if a rule fails.
  4. Post-Write — fires after a record is written. Use it for follow-on work that should only happen once the record truly exists.
  5. Pre-Delete — fires before a record is deleted, and it can prevent the delete.
  6. Post-Delete — fires after a record is deleted.
  7. Post-Read — fires after a record is read. This is the hook for work that should happen when an existing record is loaded.
  8. Pre-Totals — fires before totals are calculated. Line detail tables only.

Column events

Attach these to a specific column when the rule concerns one field's value:

  1. Pre-Validation — fires before a column value is validated, after dictionary validation but before the remaining Sage and developer validations.
  2. Post-Validation — fires after a column value is validated. This is the standard hook for reacting to a field the user just entered or changed.

Pre-events — everything except Pre-Totals — can return a failure message and interrupt further processing. That is what makes Pre-Write and Pre-Delete usable as guards, and Pre-Totals a place to act rather than a place to block.

Panel events

Attach these through Customizer when the rule concerns the screen rather than the data:

  1. PostLoad — fires after a dialog box or panel is drawn, but before focus is applied to the first control. This is the UI-side hook for work that should happen when a screen appears.
  2. OnExit — fires when focus is leaving a panel, or when a dialog box is closing.

Options and approaches

Choosing the right event

  • Validate one field as it is entered: column Post-Validation on that field.
  • Validate the whole record before it saves: table Pre-Write.
  • React after a save or delete completes: Post-Write or Post-Delete.
  • Run something when a record is loaded: table Post-Read.
  • Run something when a screen is drawn: panel PostLoad.
  • Adjust totals on a line-entry task: Pre-Totals.

The dynamic display value problem — answered honestly

A recurring request behind this topic: a script calculates a value when a record loads (for example, in Item Maintenance) and the value is for display only — yet because the script stores it in a user-defined field, the business object treats every record as changed, and users are asked whether they want to save changes to records they never edited.

Be clear about what is documented: there is no confirmed published method for displaying a dynamically calculated value on a Sage 100 panel without a UDF, and no documented event avoids the changed-record state once a script writes a field value through the business object. Post-Read is the correct documented hook for a load-time calculation, and PostLoad is the correct documented hook for panel-side work — but neither changes the fact that writing the result into a UDF marks the record as changed. Setting the value of a plain Customizer textbox instead runs into a documented dead end: a customizer-added textbox cannot be referenced by name or ID through the UI object, and no SetValue-style method for arbitrary panel controls is documented.

Practical ways sites live with this — all unconfirmed: none of the following is documented Sage guidance for this problem, and none is a confirmed resolution. They are mitigations sites adopt once the documented dead ends above are accepted:

  1. Accept the UDF, but write it only when the calculated value actually differs from the stored one, so records whose value has not changed are not dirtied on every load.
  2. Keep the calculated value out of the maintenance panel entirely — surface it on a report, an inquiry, or a lookup where display-only data belongs.
  3. If the value must appear on the panel and must never prompt, treat it as a customization project (a developer-level panel modification), not a user-defined script — and budget for it accordingly.

Escalation path: if none of the mitigations is acceptable, escalate with the specifics, not the symptom: open a case with Sage Support or brief a Sage development partner with the exact panel, the table and event you attached the script to (for example, a Post-Read script on the item table), the UDF save-prompt behaviour you observed, and the Customizer-textbox dead end you already ruled out. That record is what separates "no documented route exists" from "we did not try" — and a developer-level panel modification, quoted as a project, is the realistic next step if the requirement is firm.

What doesn't work

  • Storing a recalculated display value in a UDF on every load. It works as storage, but because the value changes each time, the record is always "changed" and users get a save prompt when leaving records they did not touch. This is the exact complaint that prompted the original discussion.
  • Setting a Customizer textbox through the UI object. There is no documented way to reference the control or set its value from a user-defined script.

Affected versions

The event catalogue above is as documented in Sage's online help for Sage 100 (2016/2017 help sets; the same event names carry forward). User-defined scripting requires the Custom Office module and Allow External Access enabled per company.

Prevention / best practice

  • Attach a script to the event that matches the source of the change, not the field you want to update — a script that sets a field should generally be triggered by the fields it depends on, or by a table event, not by the destination field itself.
  • Test scripts against records you can afford to break, in a test company, before attaching them in production — a Pre-Write script that fails wrong can block every save on that table.
  • Document each script's event, table, and purpose where your team can find it; orphaned scripts are a common cause of "Sage is behaving strangely" mysteries years later.

Related help

Still stuck? Send us a screenshot of the error, we will diagnose it for free.

Digit Masters has supported Sage 100 and Sage 300 since 1997. Send the screenshot through our contact page or to contact@digitmasters.com, or call (800) 965-4262.

Ready to Optimize Your Sage ERP?

Speak with a CPA-led Sage consultant. Free initial consultation — English or Chinese.

Get a Free Consultation