2026-11-27

Sage 100 oUIObj.SetControlProperty: Setting Control Properties in a User-Defined Script

The Sage 100 scripting docs never list a control's properties for oUIObj.SetControlProperty. Here is how to enumerate them with GetControlProperty "*", set a grid's Backcolour$, and lock grid cells with Row, Column and Lock.

You are writing a Sage 100 User-Defined Script and you want to change how a control behaves or looks — lock cells in the lines grid, colour the grid, disable a field. You reach for oUIObj.SetControlProperty, and then you hit the wall everyone hits: the documentation tells you the method exists but never lists which properties any given control actually supports.

That list does not exist, by design. Sage's own explanation is that the documentation is a guide, because every control type exposes different properties and no catalogue could cover them all. The way forward is to ask the control itself — and for grids, to aim at the cell before you set anything on it. Both techniques are below, from Sage's own scripting staff.

The fix

Step 1 — Enumerate any control's properties at runtime

Pass "*" as the property name to GetControlProperty and the control hands you its property list:

retVal = oUIObj.GetControlProperty(ctlName, "*", props)

Run this against the control you are working with, inspect what comes back in props, and you have the exact property names SetControlProperty will accept for that control — for your version, on your panel, instead of a generic list from a manual.

Step 2 — Set a property on an ordinary control

Call SetControlProperty with the control name, the property name, and the value. The example the original asker confirmed working — setting the lines grid's background colour:

retVal = myUIObj.SetControlProperty("GD_LINES", "Backcolour$", "RGB: 000 000 255")

Note the details, because all three are traps: the property is spelled Backcolour$ (British spelling, and it is a string property, hence the $), and the colour value uses the format "RGB: RRR GGG BBB".

Step 3 — For grids, aim first, then set: locking cells with Row, Column and Lock

Grid properties apply to cells, so before you set the attribute you must tell the grid which cell(s) you mean, in this order:

  1. Set the row. A specific row:

    retVal = oUIObj.SetControlProperty("GD_Lines", "Row", 2)
    

    Or the row currently in focus — read it first, then set it:

    curRow = 0
    retVal = oUIObj.GetControlProperty("GD_Lines", "CurrentRow", curRow)
    retVal = oUIObj.SetControlProperty("GD_Lines", "Row", curRow)
    

    Or every row at once: set "Row" to 0.

  2. Set the column. By position:

    retVal = oUIObj.SetControlProperty("GD_Lines", "Column", 2)
    

    Or by field name, which survives users rearranging columns:

    retVal = oUIObj.SetControlProperty("GD_Lines", "Column$", "UnitCost")
    

    Or every column of the selected row: set "Column" to 0.

  3. Set the attribute on the aimed cell(s). To lock them:

    retVal = oUIObj.SetControlProperty("GD_Lines", "Lock", 1)
    

    The Row/Column selection persists from your aim calls, so the sequence matters: aim row, aim column, then set. Whatever spelling you see in any forum copy, the control name to use is GD_Lines — that is the standard lines-grid control name, corroborated across Sage's scripting material.

Options and approaches

Which event should the script hang on?

This is the decision that makes or breaks a SetControlProperty script. Sage 100 itself uses these same control properties, so the product can set a contrary value after your script runs and silently undo your work. If your lock or colour "doesn't stick," the usual cause is not your code — it is your event firing before Sage's own panel logic runs. Move the script to a later event on the panel and retest before you rewrite anything.

Row/column by position versus by name

Positional addressing ("Column", 2) is shorter; name addressing ("Column$", "UnitCost") keeps working when the grid's column order changes or a user has rearranged their view. For anything you intend to leave in production, the name form is the safer default for columns. Rows have no names, so row work is positional or CurrentRow-based by necessity.

What doesn't work

  • Looking for the master property list. It is not missing from your copy of the documentation; it was never published. The "*" enumeration call is the documented substitute.
  • Setting Lock (or any cell attribute) without aiming first. With no Row/Column set, you have not told the grid which cells the attribute belongs to — aim, then set, every time.
  • Assuming a property that works on one control works on another. Properties are per control type. Enumerate the specific control you are targeting.

Affected versions

No version is named in the source discussion. oUIObj, GetControlProperty and SetControlProperty are part of the Sage 100 Customizer / User-Defined Script framework, and GD_Lines is the standard lines-grid control name on entry panels. Because property sets vary by control and can vary by release, enumerate on the version you are actually scripting — Step 1 makes that a one-line check.

Prevention / best practice

  • Start every new panel script with the "*" enumeration during development and keep the output in your script comments; the next person to maintain the script will thank you.
  • Treat SetControlProperty as a sharp tool: it exposes all of a control's properties, including ones Sage's own logic depends on. Change the minimum, test the full entry workflow afterwards (add, edit, delete, accept), and test as a non-administrator user.
  • Prefer Column$ with a field name over positional column numbers in production scripts.

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