Dynamics 365 Blog - Posts from Juni 2018
These posts are machine-translated.
Create lookup for simple unbound stringcontrolThe following code is intended to demonstrate how to add lookup functionality to a data-unbound StringControl.
[Control("String")]
class FormStringControl1
{
public void lookup()
{
//super();
SysTableLookup systableLookup =
SysTableLookup::newParameters(tableNum(CustGroup), this);
systableLookup.addLookupfield(fieldNum(CustGroup, CustGroup), true);
systableLookup.addLookupfield(fieldNum(CustGroup, Name), false);
systableLookup.performFormLookup();
}
}
The next example is an extension of the above, but now a query is used to limit the values ??to be displayed.
[Control("String")]
class FormStringControl1
{
public void lookup()
{
//super();
SysTableLookup systableLookup =
SysTableLookup::newParameters(tableNum(CustGroup), this);
Query query;
query = new Query();
query.addDataSource(tableNum(CustGroup));
query.dataSourceTable(tableNum(CustGroup)).addRange(
fieldNum(CustGroup, CustGroup)).value("??");
systableLookup.parmQuery(query);
systableLookup.addLookupfield(fieldNum(CustGroup, CustGroup), true);
systableLookup.addLookupfield(fieldNum(CustGroup, Name), false);
systableLookup.performFormLookup();
}
}
|
|
|
|
|
|
|
|

Under C:UsersYourUsernameDocumentsVisual Studio 2015Settings there is an XML file named DefaultConfig.xml.
In this file you can enter a model in the DefaultModelForNewProjects node.
Here the name of the model must be entered, not the display name.