How to set Banktransaction type mandatory in customer journal payment form

Hi all,

Banktransaction type mandatory in customer journal payment form , am writing below code but while selecting other lookups(method of payment and selecting bankaccount) am getting error please help me 

[FormControlEventHandler(formControlStr(LedgerJournalTransCustPaym, LedgerJournalTrans_OffsetAccountType), FormControlEventType::Modified)]
public static void LedgerJournalTrans_OffsetAccountType_OnModified(FormControl sender, FormControlEventArgs e)
{
BankParameters bankparameters;
LedgerJournalTrans LedgerJournalTrans;
FormRun element = sender.formRun();
FormStringControl BanktransactionType = element.design(0).controlName('LedgerJournalTrans_BankTransType');
//FormStringControl BanktransactionType = element.design(0).controlName('BankTransType');
BanktransactionType.autoDeclaration(NoYes::Yes);
select firstonly BankTransactionType from bankparameters;
if(bankparameters.BankTransactionType == NoYes::Yes && sender.valueStr() == enum2Str(LedgerJournalACType::Bank))
{
BanktransactionType.mandatory(true);
}
else if(sender.valueStr() != enum2Str(LedgerJournalACType::Bank))
{
BanktransactionType.mandatory(false);
}
}

Related
Recommended