I have created a customized screen in Dynamics 365 F&O named 'Create Salaries GL.' Recently, I added two new lookup fields, 'MainAccount' and 'SchoolDim,' to the screen. While the 'SchoolDim' lookup works perfectly and displays data for all users, the 'MainAccount' lookup does not display any data for certain users, despite having valid data in the table.
I have ensured that the affected users have the appropriate roles and permissions for this screen, but the issue persists. Below is the code I used for the lookup logic for both fields:
MainAccount Lookup Code:
[Control("String")]
class MainAccountList
{
public void lookup()
{
MainAccountList.text("");
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(HcmWorker), this);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
qbr.value(strFmt('!%1', queryValue('')));
sysTableLookup.performFormLookup();
}
SchoolDim Lookup Code:
class SchoolList
{
public void lookup()
{
SchoolList.text("");
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(SalaryManagement_EntryData_Sti), this);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
qbds = query.addDataSource(tableNum(SalaryManagement_EntryData_Sti));
qbds.addGroupByField(fieldNum(SalaryManagement_EntryData_Sti, School));
query.queryType(QueryType::Join);
qbr = qbds.addRange(fieldNum(SalaryManagement_EntryData_Sti, School));
qbr.value(strFmt('!%1', queryValue('')));
qbr.value(strFmt('%1', curExt()));
sysTableLookup.addLookupField(fieldNum(SalaryManagement_EntryData_Sti, School));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Note: The MainAccount
field is based on the HcmWorker
table, while the SchoolDim
field is based on the SalaryManagement_EntryData_Sti
table (a custom table).
Attached is a screenshot of the issue for further clarification.
Could anyone advise on why the MainAccount
lookup might not be displaying data for some users and how to resolve this issue?
Thank you in advance for your assistance!"