SyteLine Form Script Generator for WinStudio Forms
This generator writes a WinStudio form script method for SyteLine 9.x and CSI 10.x that reads the current record, loads rows from another IDO and puts the result in a form variable. It covers the pattern behind most small form customizations: look something up and show it without leaving the form.
Fill in
Keep the class name exactly as the Form Script editor creates it for this form.
Zero-based position of the property to total within the property list above.
Only used in block 3. Must be a real property on the primary IDO, for example a user-defined field you added.
1. Form script method (VB)
Option Explicit On
Option Strict On
Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports Mongoose.IDO.Protocol
Imports Mongoose.Scripting
' Keep the Namespace and class header exactly as the Form Script editor generates them.
Namespace SyteLine.FormScripts
Public Class Items
Inherits FormScript
Public Sub CheckItemOnHand()
Dim oCache As IWSIDOCollection = ThisForm.PrimaryIDOCollection
Dim sItem As String = oCache.GetCurrentObjectProperty("Item")
If String.IsNullOrEmpty(sItem) Then
Application.ShowMessage("No current record selected.")
Return
End If
' Double any single quote so the value cannot break the filter.
Dim sFilter As String = String.Format("Item = '{0}'", sItem.Replace("'", "''"))
' IDO name, property list, filter, order by, record cap (0 = all rows)
Dim oResp As LoadCollectionResponseData = Me.IDOClient.LoadCollection("SLItemWhses", "Whse,QtyOnHand", sFilter, "Whse", 0)
Dim total As Decimal = 0D
Dim qty As Decimal
For i As Integer = 0 To oResp.Items.Count - 1
If Decimal.TryParse(oResp.Items(i).PropertyValues(1).Value, NumberStyles.Any, CultureInfo.InvariantCulture, qty) Then
total += qty
End If
Next
ThisForm.Variables("vOnHand").Value = total.ToString(CultureInfo.InvariantCulture)
Application.ShowMessage(String.Format("Item {0}: total on hand across warehouses is {1}", sItem, total))
End Sub
End Class
End Namespace2. Wire the method to an event
' 1. Open the form in Design Mode and open the Form Script editor; paste the Sub into the class. ' 2. Add a form variable named vOnHand (Form > Variables) if it does not exist, ' and bind a display component to it if users should see the value. ' 3. Add a button and give it a custom event, for example CheckOnHand. ' 4. Add an event handler for that event: response type Script, method CheckItemOnHand. ' (The wording of the response type list differs slightly between Mongoose versions.) ' 5. StdFormPredisplay runs before the primary collection has records, ' so GetCurrentObjectProperty usually returns an empty value there. ' Use it only for setup work, and run lookups like this one from a button or a later event. ' 6. Save, exit Design Mode, refresh the form and test with a known item.
3. Optional: write to a collection property instead of a variable
' Replace the ThisForm.Variables line in block 1 with this when the value belongs on the record.
' This marks the row modified and refreshes bound components; the user still saves the record.
oCache.SetCurrentObjectPropertyPlusModifyRefresh("UfOnHandTotal", total.ToString(CultureInfo.InvariantCulture))
' Secondary collections on the same form are reached by index, for example:
' Dim oSec As IWSIDOCollection = ThisForm.GetSecondaryIDOCollection(2)
' Confirm the collection index on your form in Design Mode before relying on it.Written against SyteLine 9.x / CSI 10.x Mongoose form scripts (VB). Verify on your version before production: the class header the editor generates (Inherits FormScript and the namespace), the five-argument IDOClient.LoadCollection overload, and that the IDO and property names exist for your user. Test in a non-production configuration and export the form to a vendor-free customization layer, not the vendor layer.
Get your form script reviewed
Send us the generated script and your SyteLine version; we will check the class header, IDO names and event wiring before you deploy.
Optional. The tool and every export work without this. No spam.
How to use it
Set the form name to the class the Form Script editor generates for your form, then name the method and the property you read from the current record. Choose the IDO to load and its property list, and give the zero-based position of the numeric property you want to total. The filter template uses {0} for the current value, so Item = '{0}' becomes Item = 'PN-48213' at run time. The script doubles single quotes in the value before building the filter. Finally name the form variable that receives the total and the message the user sees.
- Property names are IDO property names (QtyOnHand), not column names (qty_on_hand).
- Record cap 0 returns all matching rows; keep the filter tight.
- Values come back as strings; the script parses them with the invariant culture.
Where this lives in SyteLine
Open the form, switch to Design Mode and open the Form Script editor for that form. The script is a class that inherits FormScript; ThisForm gives you the form, ThisForm.PrimaryIDOCollection the main collection (an IWSIDOCollection), ThisForm.Variables the form variables and Application.ShowMessage a message box. Me.IDOClient lets the script call any IDO the user has rights to, which is how this method reaches SLItemWhses from the Items form. Event handlers connect the method to a button, a property change or a form event. The customization is saved at the scope you are editing in, so pick the site or group scope deliberately.
Worked example: on-hand total on the Items form
With the defaults, a user on the Items form selects PN-48213 and clicks a Check On Hand button. The script reads Item from the current row, loads Whse and QtyOnHand from SLItemWhses filtered to that item and ordered by warehouse, and adds QtyOnHand across the rows. If MAIN holds 120 and WH2 holds 35, vOnHand becomes 155 and the message reads Item PN-48213: total on hand across warehouses is 155. If the item has no warehouse rows the total is 0, which is a useful signal in itself.
Version differences and gotchas
SyteLine 8 used WinStudio scripts with different editors and conventions, so treat this as 9.x and later code. Option Strict On forces explicit conversions; keep it, it catches type errors at compile time. Writing to a collection property with SetCurrentObjectPropertyPlusModifyRefresh marks the row modified, so the user still has to save; writing to a form variable does not touch data. Running lookups in StdFormPredisplay fails quietly because no record is current yet. Large loads in a form script block the user interface, so filter to the current record and avoid record cap 0 on wide IDOs.
- Check the method compiles in the editor before wiring events.
- Keep customizations out of the vendor layer so upgrades do not overwrite them.
- Grant the user group read access to the IDO you load.
Frequently Asked Questions
What is a form script in SyteLine 10?
A form script is a VB or C# class attached to a WinStudio form in Mongoose. It inherits FormScript and exposes methods that event handlers call. Through ThisForm, Application and IDOClient it can read and set form values, show messages and load or update data through IDOs, all inside the user's session and permissions.
Is a form script the same as personalization?
No. Personalization changes layout, captions, defaults and visibility without code and is the first thing to try. A form script is code for behaviour personalization cannot express, such as looking up another IDO and computing a value. Use the lightest option that works, because scripts need testing after each upgrade.
Why does GetCurrentObjectProperty return an empty string?
Usually because no record is current when the method runs, for example in StdFormPredisplay or before a filter-in-place has loaded rows. It also happens when the property name is wrong or belongs to a secondary collection. Run the method from a button or later event and check the exact property name on the primary IDO.
Can a form script update data in another IDO?
Yes, IDOClient also exposes UpdateCollection and method invocation, and updates go through the IDO with its validation. Keep updates rare in form scripts, confirm with the user before posting, and prefer an IDO method or extension class when the logic must also run from integrations, not only from one form.
If your team wants to ask SyteLine questions like this in plain English on your own servers instead of adding a script per form, we can set that up read-only.
Related Tools
SyteLine Custom Stored Procedure IDO Method Generator
Build a SyteLine-style stored procedure with typed parameters, @Infobar messaging and a severity return code, then test it and publish it as an IDO method.
Developer ToolsSyteLine Mongoose .NET Client Generator
Generate an external C# program that logs on through the Mongoose .NET client library and loads SyteLine IDO data, with custom load and nested load options.
Infor SyteLineSyteLine Form Personalization Checklist
A practical checklist for scoping, building, testing, documenting and upgrading SyteLine form personalizations without creating upgrade debt.
Infor SyteLineSyteLine IDO Names Reference
Searchable list of common SyteLine IDO names with the underlying tables, to speed up REST integrations and form work.
More Developer Tools tools
See all- SyteLine IDO REST Request Generator
- SyteLine SQL Query Generator for Item, Job and Order Tables
- SyteLine SQL Blocking and Long Running Query Script Generator
- SyteLine Custom Table CREATE Script Generator
- SyteLine Mongoose Framework Events Reference
- SyteLine Event Action Types Reference
- SyteLine Event Action Parameter Functions Reference
- SyteLine WinStudio Standard Form Events Reference
- SyteLine Mongoose API Options Reference
Keep exploring
Free tools
- SyteLine Custom Table CREATE Script GeneratorCreates a SQL Server CREATE TABLE script for a custom SyteLine table that follows the standard column and key conventions.
- SyteLine IDO Extension Class Method GeneratorFill in the IDO, method and load details and get a complete C# extension class with a hand-coded method, a request-object variant and the deployment steps.
- SyteLine IDO REST Request GeneratorFill in host, configuration, IDO, properties and filter to get ready-to-use REST calls for loading, updating and invoking methods on SyteLine IDOs.
ERP fixes and how-tos
- SyteLine FormScripts, validators, personalization and bookmarksA practical intro to SyteLine FormScripts and validators, plus personalization and bookmarking options, with guidance on when each is the right tool.
- Fixing SyteLine's 'Object reference not set to an instance of an object' errorSyteLine throws 'object reference not set to an instance of an object' when a form or IDO method hits a null value. Here is how to trace it to the field, IDO method or customization that is missing data, with real fixes.
- How to Add a Custom Method to a SyteLine IDO in C#How to expose a new server-side operation on a SyteLine IDO: define the method on the IDO Collection, implement it in C#, and call it safely.
Guides
- Performance Best Practices for SyteLine Form ScriptsOptimize SyteLine form script performance. Avoid common bottlenecks in event handlers, reduce IDO calls, and build responsive forms in Infor CloudSuite Industrial.
- Working with Form Variables and Properties in SyteLineWork with SyteLine form variables, session properties, and component properties. Manage state across events and forms in Infor CloudSuite Industrial development.
- InvokeIDO Method Examples for SyteLine ScriptsPractical SyteLine InvokeIDO method examples for form scripts and integrations. Call standard and custom IDO methods from scripts with parameter passing and error handling.