To get the recid or any other field value we can use lookupReference method in D365FO but it is only for recid relation field only.
We can achieve by 2 ways
1. create new lookup form and calling from lookup method.
2. need to give recid relation and using lookupReference method.
Way1:
Way 2: lookupReference method
public Common lookupReference(FormReferenceControl _formReferenceControl)
{
Common ret;
// ret = super(_formReferenceControl);
SysReferenceTableLookup sysReferenceTableLookup;
Query query;
QueryBuildDataSource queryBuildDataSource;
// Add the fields that we want to display in the lookup form.
sysReferenceTableLookup = SysReferenceTableLookup::newParameters(tableNum(WMSLocation),
_formReferenceControl);
sysReferenceTableLookup.addLookupfield(fieldNum(WMSLocation, wmsLocationId));
sysReferenceTableLookup.addLookupfield(fieldNum(WMSLocation, LocProfileId));
sysReferenceTableLookup.addLookupMethod(tableMethodStr(WMSLocation, inventSiteId));
sysReferenceTableLookup.addLookupfield(fieldNum(WMSLocation, InventLocationId));
query = new query();
queryBuildDataSource = query.addDataSource(tableNum(WMSLocation));
queryBuildDataSource.addRange(fieldNum(WMSLocation, InventLocationId)).value(queryValue(InventLocation));
sysReferenceTableLookup.parmQuery(query);
ret = sysReferenceTableLookup.performFormLookup();
if (ret)
{
InventLocationId InventLocationId = ret.(fieldNum(WMSLocation, InventLocationId));
Info(InventLocationId);
Info(strFmt('%1',ret.RecId));
}
return ret;
}
}
Keep Daxing!!
No comments:
Post a Comment