Hi,
I am using AX 2012 R3 CU11.
I have a scenario where in need to write the below logic,
while select * from payrollPayPeriod where payrollPayPeriod.PeriodEndDate == selectedEndDate // Global Table
{
while select crossCompany * from payrollEarningStatement where payrollEarningStatement.PayPeriod == payrollPayPeriod.RecId // Not a Global Table
{
while select crossCompany * from payrollEarningStatementLine where payrollEarningStatementLine.EarningStatement == payrollEarningStatement.RecId // Not a Global Table
{
while select * from payrollEarningCode where payrollEarningCode.RecId == payrollEarningStatementLine.EarningCode // // Global Table
.
.
.
I have 3 legal entities - A, B, C. I have few discrepancies in legal entity B which this execution of class gives as the output.
I have written this logic in a dialog and when I am running this dialog from AOT, it gets the required result irrespective of my logged-in company (i.e. be it any A or B or C )
Now I have created a separate security role for this dialog class is attached.
Now I am facing the weird issue as detailed below,
Scenario-1: Code is as detailed above above with CrossCompany keyword.
(a) When I run AX with user X = "System Admin Role" Assigned, Logged-in company - A or B or C,
When I run this class from AX client, I got the correct desired result with the records from Company B.
(b) When I run AX with user Y = "No system Admin Role" assigned, logged-in company - A or B or C,
When I run this class from AX client, it returns no result (This is wrong). I was expecting the same result as in Scenario-1 (a).
Scenario-2: Code is as detailed above above without CrossCompany keyword.
(a) When I run AX with user X = "System Admin Role" Assigned, Logged-in company - B,
When I run this class from AX client, I got the correct desired result with the records from Company B.
(b) When I run AX with user X = "System Admin Role" Assigned, Logged-in company - A or C
When I run this class from AX client, it returns no result (As Expected)
(c) When I run AX with user Y = "No system Admin Role" assigned, logged-in company - B,
When I run this class from AX client, I got the correct desired result with the records from Company B.
(d) When I run AX with user Y = "No system Admin Role" assigned, logged-in company - A or C
When I run this class from AX client, it returns no result (As Expected)
Scenario-2 is just for your reference. I am interested for scenario-1 wherein I will be assigning this functionality to the users not having admin rights but having access to all the legal entities.
I am not sure where I am missing what which is causing this issue?
Can someone please help me resolve this issue as it seems to be a very minor issue.
Thanks in advance.
Sincerely,
Muneeb