Archive for Kasım 22nd, 2021

Dynamics 365 Finance and Operations Event Handler Kullanımı?

Bu yazıda Dynamics 365 Finance and Operations içinde standart bir formda Event Handler kullanarak nasıl işlemler yapabilirsiniz göstermeye çalışacağım.

Bir önceki yazımda Form DataSource metotlarına Extension ile ekleme yapmayı anlatmıştım. CustInvoiceJournal formuna E-Fatura filtresi için bir DataSource eklemiştim. Şimdi orada eklenen filtreyi kullanıcının kaldırabilmesi için bir CustInvoiceJournal formuna CheckBox ekledim. Bu CheckBox’ın işaretlenmesi ile tüm kayıtları göstereceğim.

Events kısmından OnClicked’e sağ tıklayıp Copy event handler method diyorum.

Resim-1

Yeni bir class oluşturup kodu yapıştırıyorum.

class CustInvoiceJournal_FD_EventHandler // Class isimlendirmede hala bazen karışıyor ama ekip içinde bir standart oturtmak lazım.

{

/// <summary>

///

/// </summary>

/// <param></param>

/// <param></param>

[FormControlEventHandler(formControlStr(CustInvoiceJournal, DmrShowAllRecord), FormControlEventType::Clicked)] // Kopyalama sonucu bu geliyor zaten.

public static void DmrShowAllRecord_OnClicked(FormControl sender, FormControlEventArgs e)

{

QueryBuildDataSource    custInvoiceJourDS;

QueryBuildDataSource    eInvoicePoolTableDS;

FormRun                 elementForm         = sender.formRun();

FormCheckBoxControl     showAllRecord      ;

FormDataSource          custInvoiceJour_ds  = elementForm.dataSource(formDataSourceStr(CustInvoiceJournal, CustInvoiceJour)) as FormDataSource;

#IsoCountryRegionCodes

if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoTR]))

{

showAllRecord       = elementForm.design().controlName(formControlStr(CustInvoiceJournal, DmrShowAllRecord));

custInvoiceJourDS   = custInvoiceJour_ds.query().dataSourceTable(tableNum(custInvoiceJour));

eInvoicePoolTableDS = custInvoiceJour_ds.query().dataSourceTable(tableNum(FDEInvoicePoolTable));

if(showAllRecord.checked())

{

eInvoicePoolTableDS.enabled(false);

}

else

{

eInvoicePoolTableDS.enabled(true);

}

custInvoiceJour_ds.executeQuery();

}

}

}

Bu yazıda form kontrolleri için EventHandler kullanımını anlatmaya çalıştım.

Selamlar.

www.fatihdemirci.net

TAGs: Dynamics 365 Finance and Operations, MsDyn365FO, OnClicked (), DataSource, Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365, Dynamics 365 ERP, X++