Lookup and Mandatory fields on Form using Form event Handlers D365
[FormControlEventHandler(formControlStr(VendBankAccounts, VendBankAccount_SLD_BankCode), FormControlEventType::Lookup)]
public static void VendBankAccount_SLD_BankCode_OnLookup(FormControl sender, FormControlEventArgs e)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
FormControlCancelableSuperEventArgs event = e as FormControlCancelableSuperEventArgs;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(SLD_BankCodes), sender);
sysTableLookup.addSelectionField(fieldNum(SLD_BankCodes, BankCodes));
sysTableLookup.addLookupField(fieldNum(SLD_BankCodes, BankCodes));
sysTableLookup.addLookupField(fieldNum(SLD_BankCodes, Description));
queryBuildDataSource = query.addDataSource(tableNum(SLD_BankCodes));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
event.CancelSuperCall();
}
[FormEventHandler(formStr(VendBankAccounts), FormEventType::Activated)]
public static void VendBankAccounts_OnActivated(xFormRun sender, FormEventArgs e)
{
FormDataSource VendBankAccounts_DS = sender.dataSource(tableStr(VendBankAccount));
VendBankAccounts_DS.object(fieldNum(VendBankAccount, BankIBAN)).mandatory(true);
VendBankAccounts_DS.object(fieldNum(VendBankAccount, SLD_BankCode)).mandatory(true);
}
Comments
Post a Comment