How to use Form Data source Activeted method in D365
Here i am going to write code in Active event of form-> data source.
SalesTable-> DS->salesLine-> event-> copy event of Activated.
1. create class.
2. paste copied event in class.
3. class Data source by
FormDataSource fds = sender.formRun().dataSource("SalesLine");
SalesLine salesline = fds.cursor();
4. put logic according you.
class Aks_SODSSLActivated
{
///
<summary>
///
///
</summary>
/// <param
name="sender"></param>
/// <param
name="e"></param>
[FormDataSourceEventHandler(formDataSourceStr(SalesTable, SalesLine), FormDataSourceEventType::Activated)]
public static void SalesLine_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
real
Amount,amt1;
Tax
tax;
FormDataSource fds =
sender.formRun().dataSource("SalesLine");
SalesLine salesline =
fds.cursor();
if(salesline.LineDisc > 0 || salesline.LinePercent >0)
{
fds.object(fieldNum(SalesLine,Aks_givenDiscount)).allowEdit(false);
salesline.Aks_givenDiscount =0;
}
else
{
fds.object(fieldNum(SalesLine,Aks_givenDiscount)).allowEdit(true);
}
}
}
Thanks
Akshay
No comments:
Post a Comment