Developer ToolsFree generatorPDF, Excel, Word exportInfor SyteLineAll Infor SyteLine (CloudSuite Industrial) tools

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.

Generated code
Download:

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 Namespace

2. 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.

Was this tool useful?

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.

ArchRay builder
Design the on-prem AI stack for Infor SyteLine: model, GPUs, RAG pipeline, guardrails
See memory, speed and cost as you swap parts, then export the diagram. Free, in your browser.
Open the builder

Keep exploring

Free tools

ERP fixes and how-tos

Guides