Monday, March 11, 2019

Expression in query ranges example Dynamics 365/AX 2012


Override form lookup method along with OR condition in query range.

public void lookup(FormControl _formControl, str _filterStr)
{
    //super(_formControl, _filterStr);
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventLocation),_formControl);
    Query query = New Query();
    QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(InventLocation));
    QueryBuildRange queryBuildRange;
    ;

    sysTableLookup.addLookupfield(fieldNum(InventLocation, InventLocationId));
    sysTableLookup.addLookupfield(fieldNum(InventLocation, Name));
    sysTableLookup.addLookupfield(fieldNum(InventLocation, InventSiteId));

    queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventLocation, RecId));
    queryBuildRange.value(strFmt('((InventLocationType == %1) || (InventLocationType == %2))',
                            any2int(InventLocationType::Standard),
                            any2int(InventLocationType::Transit)));
  
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

No comments:

Post a Comment

Happening

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence. 1. Create new Upgrade project in Dynamics LCS. 2. Create VSTS Project and connect it with L...

Trending now