Here is an example that shows how you can create a Form Control extension class. I was required to change the data source field value based on the display field's value.
[ExtensionOf(formControlStr(MainAccount, Administration_IsSuspended))]
final class MainAccount_Administration_IsSuspended_Extension
{
public boolean modified()
{
boolean ret = next modified();
FormRun formRun = this.formRun();
MainAccount mainaAcount = formRun.dataSource(formdatasourcestr(MainAccount, MainAccount)).cursor();
if (this.valueStr() == 'Yes')
{
mainaAcount.SuspendedDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());
}
else
{
mainaAcount.SuspendedDate = dateNull();
}
return ret;
}
}
[ExtensionOf(formControlStr(MainAccount, Administration_IsSuspended))]
final class MainAccount_Administration_IsSuspended_Extension
{
public boolean modified()
{
boolean ret = next modified();
FormRun formRun = this.formRun();
MainAccount mainaAcount = formRun.dataSource(formdatasourcestr(MainAccount, MainAccount)).cursor();
if (this.valueStr() == 'Yes')
{
mainaAcount.SuspendedDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());
}
else
{
mainaAcount.SuspendedDate = dateNull();
}
return ret;
}
}
*This post is locked for comments