Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article discusses how to enable lookup behavior on controls. It also discusses how to create multi-select lookups and outlines lookup scenarios that are no longer supported.
Controls with their Extended Data Type property set (no FormDataSource in play) have a lookup under the following conditions:
Controls that are bound to a data source can have a lookup under the following conditions: Field bound
The “lookup” or “lookupReference” (Reference Controls) methods are overridden.
If the field has an EDT, then rule #2 from the "Controls bound to an Extended Data Type" section applies.
If the bound field maps to a relation per DBFGetRef rules.
If there's an EDT relation backing the field, with the Table Relations node populated and Ignore EDT Relations is false on the field, the relation is used (has a lookup).
If there's a relation mapping to the field and any fixed field link conditions are satisfied, the relation is used (has a lookup).
Note the special case of migrated EDT relations that occurs when:
You can also have cases where IgnoreEDTRelation is set to true on a field, in which case a lookup occurs only if rule #3.1.2 of this section is true.
Data method bound
There are currently two system forms for creating multi-select lookups:
SysLookupMultiselect was marked for deprecation in Microsoft Dynamics AX 2012 and was removed. Any use of this form for multiselect lookup scenarios should be migrated to use SysLookupMultiselectGrid. For an example, see the form tutorial_LookupMultiSelectGrid.
An error may occur if you create multiple lookup forms when the lookup button is used. For example, overriding the ‘lookup’ method and creating a new lookup form, but also calling ‘super’ (which creates another lookup form).
Using SelectedControl() to determine which control is hosting a lookup is unsupported. While it may work in some cases, it fails in others. For example, in disambiguation lookups, no control is selected on the parent form since the act of leaving the control is what triggers a disambiguation lookup. As an alternative to using SelectedControl(), there are a few other ways to retrieve the control that is hosting the lookup:
Check the ‘selectTarget’ of the lookup form.
FormStringControl selectTarget = formRun.selectTarget();
Check the ‘callerFormControl’ on the lookup form args. SysTableLookup::getCallerControl(Args args) encapsulates that call.
FormStringControl argsCallerFormControl = args.callerFormControl();
The selectTarget and callerFormControl are set automatically if the lookup form instance is generated automatically by the kernel. If the form instance is created in app code, they can be set manually as shown in the following example.
public void lookup()
{
Args args = new Args(formStr(<formName>));
args.caller(element);
args.callerFormControl(this);
FormRun formRun = classfactory.formRunClass(args);
formRun.init();
this.performFormLookup(formRun);
}
Lookup controls should open lookup forms when the lookup button is used (not slider dialogs or other kinds of forms). The first reason for this functionality is product consistency. The second and more important reason is that opening a slider dialog from a lookup is incompatible with the new type-ahead feature in lookups.
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Module
Use and understand Controls in a canvas app in Power Apps - Training
Controls help create a better experience for the user and collect the appropriate data. This module helps you understand and use Controls.
Documentation
Images on a page or in a grid - Finance & Operations | Dynamics 365
Learn about the steps for displaying images on a page or in a grid, including overviews of various image types with code examples.
X++ exception handling - Finance & Operations | Dynamics 365
Learn about exception handling in X++, which are regulated jumps away from sequence of program executions. These include throw statements andg global class methods.
Add methods to tables through extension - Finance & Operations | Dynamics 365
Learn how to add a method to a table by using an extension, including code examples for adding methods to tables.