Working with Form Variables and Properties in SyteLine
SyteLine forms expose multiple levels of state that developers must understand: IDO properties representing database columns, form variables for transient UI state, session properties for cross-form communication, and component properties controlling UI behavior. Knowing when to use each type and how they interact with the form lifecycle prevents common bugs like lost values during navigation, unintended state persistence, and inconsistent UI behavior.
IDO Properties vs Form Variables
IDO properties are backed by database columns and persist when the user saves the form. They are the primary data channel for reading and writing business data. Form variables, by contrast, exist only in the form's script context and are not saved to the database. Use form variables for computed display values, temporary calculation results, state flags that control script behavior, and UI-only information. Form variables are declared in the form script and maintain their values as long as the form is open, but they reset when the form closes and reopens.
- IDO property: GetCurrentObjectProperty("CustNum") returns the customer number from the database row
- Form variable: var isEditMode = false; declared at script scope, persists across event handler calls
- IDO properties survive save/reload; form variables reset on form close
- Use form variables for flags: isFirstLoad, lastValidatedItem, cachedCalculation
- Never store business data in form variables; they are invisible to reports, integrations, and audit trails
Session Properties and Cross-Form Communication
Session properties provide a mechanism to share data between multiple open forms in the same SyteLine session. When the user opens a customer order from the customer form, session properties can pass the selected customer number to pre-filter the order form. Set session properties using ThisForm.Session.SetVariable and read them in other forms using ThisForm.Session.GetVariable. Session properties persist for the duration of the SyteLine client session and can be used to maintain context, pass parameters to child forms, and coordinate multi-form workflows.
- Set session variable: ThisForm.Session.SetVariable("SelectedCustNum", custNum) in the source form
- Read session variable: var custNum = ThisForm.Session.GetVariable("SelectedCustNum") in the target form
- Use for form-to-form navigation context: pass the selected record key to a detail form
- Clean up session variables in StdFormClosed to prevent stale data from affecting future form opens
- Name session variables with a prefix: "MyCustom_CustNum" to avoid collisions with standard variables
Component Properties and UI State Management
Every form control exposes properties that govern its visual appearance and behavior: Visible, Enabled, ReadOnly, BackColor, ForeColor, and Text among others. Managing these component properties consistently across event handlers is crucial for a polished user experience. Create a centralized UI state function that evaluates all conditions and sets all component properties in one pass, called from StdObjectLoaded and any event that changes the form state. This prevents the scattered, inconsistent UI updates that make SyteLine forms feel buggy.
- Centralized UI state: function ApplyFormState() { sets Visible, Enabled, ReadOnly for all conditional controls }
- Call ApplyFormState from StdObjectLoaded, StdObjectNew, and any status-change event handler
- Component property access: ThisForm.Components["txtAmount"].ReadOnly = (status == "Approved")
- Track UI state: use a form variable like currentUIState to avoid redundant property updates
- Reset on new: ensure ApplyFormState handles new records (empty values, default states) correctly
Netray AI agents analyze your SyteLine form state management patterns and recommend optimizations. Build forms with clean, maintainable state management from the start.
Related Resources
SyteLine Form Event Handlers Guide
Master SyteLine form event handlers including StdObjectLoaded, StdObjectSaved, and StdObjectDeleted. Build responsive forms in Infor CloudSuite Industrial.
Infor SyteLineSyteLine Conditional Visibility Scripts
Show and hide SyteLine form fields dynamically based on data values. Conditional visibility scripts for tabs, grids, and controls in Infor CloudSuite Industrial.
Infor SyteLineSyteLine Form Data Flow Patterns
Understand SyteLine form data flow from IDO to UI and back. Master the data lifecycle including load, edit, validate, and save patterns in CloudSuite Industrial.