I have a custom query for security of user in AX 2012 R3.
The query returns the data from table "RetailUserStoreTable". I have ranges on User and PrimaryStore, the value assigned to the user is "(CurrentUserID())" and the value assigned to the PrimaryStore is "Yes".
When I run the query in a job in AOT then it gives the correct result. But when I use this query in SSRS data method it doesn't give the correct result. It returns all the users in data method. The code written in data method is:
[DataMethod(), PermissionSet(SecurityAction.Assert, Name = "FullTrust")]
public static IEnumerable<DataRow> AXSecurity()
{
int count = 0;
IEnumerator<DataRow> enumerator;
IEnumerable<DataRow> dataRows;
dataRows = AxQuery.ExecuteQueryStream("select * from AxUserSecurities");
enumerator = dataRows.GetEnumerator();
while (enumerator.MoveNext())
{
count++;
}
// reset the enumerator to move its pointer to the initial state
enumerator.Reset();
return dataRows;
}
The code in the data method and the AX Query are working fine in AX 2012 R2 but not in R3.
Kindly help me if anyone knows the solution.