Unfortunately, the useful function SysLookup::lookupDimension() was removed from Dynamics 365 for finance and operations
http://blog.daxteam.net/2015/04/dimenson-value-lookup-by-code-dynamics.html
Now you can find below the alternative to build a lookup
based on a financial Dimension, using event handlers on dyn365fo:
[FormControlEventHandler(formControlStr(SalesLineBackOrder,
BusinessLineFilter), FormControlEventType::Lookup)]
public
static
void
BusinessLineFilter_OnLookup(FormControl
sender, FormControlEventArgs e)
{
SysTableLookup
sysTableLookup;
Query
query;
QueryBuildDataSource
qbdsDimensionFinancialTag;
QueryBuildRange
qbrFinancialTagCategory;
#define.BusinessLine('BusinessLine')
query
= new
Query();
qbdsDimensionFinancialTag
= query.addDataSource(tableNum(DimensionFinancialTag));
qbrFinancialTagCategory
= qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag,
FinancialTagCategory));
qbrFinancialTagCategory.value(strFmt('%1',
DimensionAttribute::findByName(#BusinessLine, false).financialTagCategory()));
sysTableLookup
= sysTableLookup::newParameters(tableNum(DimensionFinancialTag), sender);
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag,
Value), true);
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag,
Description));
sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag,
FinancialTagCategory));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
No comments:
Post a Comment
if you have any doubts, please tell me