SysLookupMultiSelectCtrl does not persist selections automatically.
You need to explicitly save the selected values to a field and reload them when the form runs.
A common pattern is to store the selected IDs as a semicolon-separated string in your parameter table.
Below is a working example that extends the WHSParameters form.
It adds a multi-select lookup for excluded product lifecycle state IDs and ensures the values persist between sessions.

Form Extension:
/// <summary>
/// Extension of the <c>WHSParameters</c> form.
/// Adds support for a multi-select lookup control used to select excluded product lifecycle state IDs
/// for fixed location logic.
/// </summary>
[ExtensionOf(formStr(WHSParameters))]
public final class TestWHSParameters_Extension
{
/// <summary>
/// Holds the instance of <c>SysLookupMultiSelectCtrl</c> for the excluded state IDs control.
/// </summary>
public SysLookupMultiSelectCtrl multiSelectCtl;
/// <summary>
/// Gets or sets the <c>SysLookupMultiSelectCtrl</c> instance for the excluded state IDs control.
/// </summary>
public SysLookupMultiSelectCtrl parmMultiSelectCtl(SysLookupMultiSelectCtrl _multiSelectCtl = multiSelectCtl)
{
multiSelectCtl = _multiSelectCtl;
return multiSelectCtl;
}
/// <summary>
/// Executes after the form is run and the data source is populated.
/// Constructs the multi-select lookup control and restores saved selections.
/// </summary>
public void run()
{
next run();
FormStringControl stateIds =
this.design().controlName(
formControlStr(WHSParameters, TestProductLifecycleExcludedStateIds));
this.parmMultiSelectCtl(
SysLookupMultiSelectCtrl::construct(
this,
stateIds,
querystr(TestStateIds),
false,
[tableNum(EcoResProductLifecycleState), fieldNum(EcoResProductLifecycleState, StateId)]
)
);
}
}
And the modified event handler that persists the selected values:
/// <summary>
/// Event handler for the Product Lifecycle Excluded State IDs control on the WHSParameters form.
/// Saves the selected values into WHSParameters as a semicolon-separated string.
/// </summary>
public final class TestProductLifecycleExcludedStateIds_ModifiedEvent
{
[FormControlEventHandler(
formControlStr(WHSParameters, TestFixedLocations_TestProductLifecycleExcludedStateIds),
FormControlEventType::Modified)]
public static void TestFixedLocations_TestProductLifecycleExcludedStateIds_OnModified(FormControl sender, FormControlEventArgs e)
{
FormRun formRun = sender.dataSourceObject().formRun();
SysLookupMultiSelectCtrl multiSelectCtl = formRun.parmMultiSelectCtl();
WHSParameters whsParameters =
formRun.dataSource(formDataSourceStr(WHSParameters, WHSParameters)).cursor();
whsParameters.TestProductLifecycleExcludedStateIds =
con2Str(multiSelectCtl.getSelectedFieldValues(), ';');
}
}
🎤💥