最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

扩展示例 / Extensions examples

网络文摘 William 34浏览 0评论

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
/// <summary>
/// OnValidatedWrite handler
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[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
/// <summary>
/// OnInitialized handler
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[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);
	}
	
}
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址