Источник:
https://dynamicsaxinsight.wordpress....ions-examples/
==============
Purpose:
The purpose of this post is to share examples of extensions.
Product:
Dynamics 365 for Finance and Operations
Code:
Form data source event handler. Event type: ValidatedWrite
/// /// OnValidatedWrite handler/// /// /// [FormDataSourceEventHandler(formDataSourceStr(DirPartyQuickCreateForm, DirPartyTable), FormDataSourceEventType::ValidatedWrite)]public static void DirPartyTable_OnValidatedWrite(FormDataSource sender, FormDataSourceEventArgs e){ #define.CallerFormName("CustTable") FormRun formRun = sender.formRun(); FormDataSource dirPartyTable_DirOrganization_ds = formRun.dataSource(formDataSourceStr(DirPartyQuickCreateForm, DirPartyTable_DirOrganization)); DirOrganization dirOrganization = dirPartyTable_DirOrganization_ds.cursor(); FormDataSourceCancelEventArgs args = e as FormDataSourceCancelEventArgs; boolean doCancel; if (formRun.args().callerName() == #CallerFormName) { if (!dirOrganization.OrgNumber) { checkFailed(strFmt("Organization number is required.")); doCancel = true; } } args.cancel(doCancel);}Form event handler. Event type: Initialized
/// /// OnInitialized handler/// /// /// [FormEventHandler(formStr(DirPartyQuickCreateForm), FormEventType::Initialized)]public static void DirPartyQuickCreateForm_OnInitialized(xFormRun sender, FormEventArgs e){ #define.CallerFormName("CustTable") if (sender.args().callerName() == #CallerFormName) { DimensionEntryControl dimensionEntryControl = sender.control(sender.controlId("DimensionEntryControl")); dimensionEntryControl.parmDisplayValues(true); } }
Источник:
https://dynamicsaxinsight.wordpress....ions-examples/