Disable and enable menu item in form using record data :
class CITLedgerJournalTransCustPaym
{
QueryBuildRange citErrorLog;
// Below code is used to get
[FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTransCustPaym, LedgerJournalTrans), FormDataSourceEventType::Activated)]
public static void LedgerJournalTrans_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormDatasource fds;
LedgerJournalTrans LedgerJournalTrans;
LedgerJournalName ledgerJournalName;
FormControl CITRemitImport,CITCustImport;
FormRun element;
fds = sender.formRun().datasource('LedgerJournalTrans');
LedgerJournalTrans = fds.cursor();
element = sender.FormRun();
CITRemitImport = element.design(0).controlName('CustInRemitance');
CITCustImport = element.design(0).controlName('CustInpayment');
ledgerJournalName = LedgerJournalName::find(ledgerJournalTrans.ledgerJournalTable().JournalName);
if(ledgerJournalName.CITRemitImport)
{
CITRemitImport.visible(true);
CITCustImport.visible(false);
}
else
{
CITRemitImport.visible(false);
CITCustImport.visible(true);
}
}
}
class CITLedgerJournalTransCustPaym
{
QueryBuildRange citErrorLog;
// Below code is used to get
[FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTransCustPaym, LedgerJournalTrans), FormDataSourceEventType::Activated)]
public static void LedgerJournalTrans_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormDatasource fds;
LedgerJournalTrans LedgerJournalTrans;
LedgerJournalName ledgerJournalName;
FormControl CITRemitImport,CITCustImport;
FormRun element;
fds = sender.formRun().datasource('LedgerJournalTrans');
LedgerJournalTrans = fds.cursor();
element = sender.FormRun();
CITRemitImport = element.design(0).controlName('CustInRemitance');
CITCustImport = element.design(0).controlName('CustInpayment');
ledgerJournalName = LedgerJournalName::find(ledgerJournalTrans.ledgerJournalTable().JournalName);
if(ledgerJournalName.CITRemitImport)
{
CITRemitImport.visible(true);
CITCustImport.visible(false);
}
else
{
CITRemitImport.visible(false);
CITCustImport.visible(true);
}
}
}
No comments:
Post a Comment