how to write the event handler for the Form data source field level event handler methods.
how to write the event handler for the Form data source field level event handler methods.
Below are the list of the Form > Data source > Field level event handler methods can be written.
Let say in our example we will write the event handler for the form data source > fields level event > OnModified methods in the "LedgerJournalTransCustPaym" standard form.
1. Open the Form > LedgerJournalTransCustPaym > Data Source (LedgerJournalTrans) > Fields(UnitId) is the custom field added to LedgerJournalTrans - Events (expand the events node).
2. Right click on the OnModified > copy the event handler method. Below is the screenshot.
When modifying the custom field “UnitId” field in the form level, the Vend account (custom field added in the LedgerJournalTrans table) values needs to fetched basing on the UnitId modified.
In the same way basing on the requirement - “OnModified” event handler can be implemented on the form data source > field level event handler.
/// <summary>
/// Unitid Onmodified event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataFieldEventHandler(formDataFieldStr(LedgerJournalTransCustPaym, LedgerJournalTrans, UnitId), FormDataFieldEventType::Modified)]
public static void UnitId_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
FormDataSource ledgerJournalTrans_ds = sender.datasource();
LedgerJournalTrans ledgerJournalTrans = ledgerJournalTrans_ds.cursor();
UnitChargeTypes unitChargeTypes = UnitChargeTypes::find(ledgerJournalTrans.UnitId);
if(unitChargeTypes.Refundable == NoYes::Yes)
{
ledgerJournalTrans.VendAccount = unitChargeTypes.VendAccount;
}
else
{
ledgerJournalTrans.VendAccount = '';
}
}
In the next post we discuss about the Form > Design > Control level event handler methods.
Below are the list of the Form > Data source > Field level event handler methods can be written.
Let say in our example we will write the event handler for the form data source > fields level event > OnModified methods in the "LedgerJournalTransCustPaym" standard form.
1. Open the Form > LedgerJournalTransCustPaym > Data Source (LedgerJournalTrans) > Fields(UnitId) is the custom field added to LedgerJournalTrans - Events (expand the events node).
2. Right click on the OnModified > copy the event handler method. Below is the screenshot.
When modifying the custom field “UnitId” field in the form level, the Vend account (custom field added in the LedgerJournalTrans table) values needs to fetched basing on the UnitId modified.
In the same way basing on the requirement - “OnModified” event handler can be implemented on the form data source > field level event handler.
/// <summary>
/// Unitid Onmodified event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataFieldEventHandler(formDataFieldStr(LedgerJournalTransCustPaym, LedgerJournalTrans, UnitId), FormDataFieldEventType::Modified)]
public static void UnitId_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
FormDataSource ledgerJournalTrans_ds = sender.datasource();
LedgerJournalTrans ledgerJournalTrans = ledgerJournalTrans_ds.cursor();
UnitChargeTypes unitChargeTypes = UnitChargeTypes::find(ledgerJournalTrans.UnitId);
if(unitChargeTypes.Refundable == NoYes::Yes)
{
ledgerJournalTrans.VendAccount = unitChargeTypes.VendAccount;
}
else
{
ledgerJournalTrans.VendAccount = '';
}
}
In the next post we discuss about the Form > Design > Control level event handler methods.
Comments
Post a Comment