Archive for Aralık, 2021

Dynamics 365 Finance and Operations OnClicked Event Handler?

Bu yazıda Dynamics 365 Finance and Operations’da Event Handler nasıl kullanılır bir örnekle anlatmaya çalışacağım.

Şöyle bir örnek olsun. Standart bir forma bir CheckBox eklemek istiyoruz. Bu CheckBox işaretlendiğinde bir filtre çalışacak. Bunun için formdan bir Extension oluşturup CheckBox eklemek gerekiyor. Bu kısımları geçiyorum daha önce anlatmıştım. Burada asıl bu işaretleme olduğunda yazacağımız koda odaklanacağım.

Öncelikle bir Class oluşturmamız gerekiyor. Adının sonuna EventHandler eklemekte fayda var.

class CustInvoiceJournalEventHandler

{

/// <summary>

///

/// </summary>

/// <param></param>

/// <param name=”e”></param>

[FormControlEventHandler(formControlStr(CustInvoiceJournal, DmrShowAllRecord), FormControlEventType::Clicked)]

public static void DmrShowAllRecord_OnClicked(FormControl sender, FormControlEventArgs e)

{

QueryBuildDataSource    custInvoiceJourDS;

QueryBuildDataSource    eInvoicePoolTableDS;

FormRun                 elementForm         = sender.formRun(); // DataSource için gerekecek

FormCheckBoxControl     showAllRecord      ;

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

#IsoCountryRegionCodes

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

{

showAllRecord       = elementForm.design().controlName(formControlStr(CustInvoiceJournal, DmrShowAllRecord)); // CheckBox ‘a ulaşıyoruz.

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 EventHandler nasıl kullanılır anlatmaya çalıştım. Birçok durumda Extension yerine EventHandler kullanmak daha pratik oluyor.

Selamlar.

www.fatihdemirci.net

TAGs: Microsoft Life Cycle Services, LCS, Azure, Azure DevOps, EventHandler,Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365, X++