You need to override the init method of the data source of your form following this way for example:
public void init()
{
SysDimension SysDimension;
;
super();
if( element.args().parm())
{
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(Dimensions)), fieldnum(Dimensions, DimensionCode)).value(queryValue(element.args().parm()));
}
else
{
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(Dimensions)), fieldnum(Dimensions, DimensionCode)).value(queryValue(SysDimension::Department));
}
}
{
SysDimension SysDimension;
;
super();
if( element.args().parm())
{
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(Dimensions)), fieldnum(Dimensions, DimensionCode)).value(queryValue(element.args().parm()));
}
else
{
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(Dimensions)), fieldnum(Dimensions, DimensionCode)).value(queryValue(SysDimension::Department));
}
}