Event handler for form modified field in d365fo x++

 Event handler for form modified 


final class SalesCreateQuotations_EventHandler

 {    

/// <summary>    

///    

/// </summary>    

/// <param name="sender"></param>    

/// <param name="e"></param>    


[FormControlEventHandler(formControlStr(SalesCreateQuotation, SalesQuotationTable_CustAccount), FormControlEventType::Modified)]    

public static void SalesQuotationTable_CustAccount_OnModified(FormControl sender, FormControlEventArgs e)    

{        

FormRun                 form                    =   sender.formRun();        

FormDataSource          salesQuotationTable_ds  =   form.dataSource(formDataSourceStr(SalesCreateQuotation,SalesQuotationTable)) as FormDataSource;        

SalesQuotationTable     salesQuotationTable     =   salesQuotationTable_ds.cursor();        

CustTable               custTable;          


select  firstonly   custTable            

where   custTable.AccountNum    ==  salesQuotationTable.InvoiceAccount;          


if(custTable)        

{            

salesQuotationTable.WorkerSalesTaker    =   custTable.MainContactWorker;        

}


}

             

}

Comments