Override form control lookup – Dynamics 365 Finance and Operations

Posted by

To overrie the string control use SysTableLookup sysTableLookup;

To override the reference group control use SysReferenceTableLookup sysReferenceTableLookup;

Below is the example of reference control

[FormControlEventHandler(formControlStr(HcmDiscussionNewDialog, HcmDiscussion_PerfPeriod), FormControlEventType::Lookup)]
public static void HcmDiscussion_PerfPeriod_OnLookup(FormControl sender, FormControlEventArgs e)
{
SysReferenceTableLookup sysReferenceTableLookup;
Query query = new Query();

sysReferenceTableLookup =SysReferenceTableLookup::newParameters(tableNum(HcmPerfPeriod),sender);
sysReferenceTableLookup.addLookupfield(fieldNum(HcmPerfPeriod,PerfPeriodId));
sysReferenceTableLookup.addLookupfield(fieldNum(HcmPerfPeriod,StartDate));
sysReferenceTableLookup.addLookupfield(fieldNum(HcmPerfPeriod,EndDate));

sysReferenceTableLookup.parmQuery(query);
sysReferenceTableLookup.performFormLookup();

//Cancel the super

FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;

ce.CancelSuperCall();

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.