Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Customer Aging Report not working with XDS Policy

(3) ShareShare
ReportReport
Posted on by 389
I have a policy linked to a query that has CustTable as a primary table and joined with another table that stores a few customers (AccountNum).. So when the policy is applied the user can only see only few customers.
 
It works fine but I have a problem in Customer Aging Report... the report runs smoothly but when I go to "records to include" tab and choose Employee Responsible field the report crashes with this error:

 
and here's the query that fails:
"INSERT INTO tempdb."DBO".t13749IISdvhd7481vm_718228_97F2BCF42E8E47F7BCD2A58802DCF4DD (ACCOUNTNUM,GROUPID,ACCOUNTNUM,GROUPID) 
SELECT T1.ACCOUNTNUM AS f1,T1.CUSTGROUP AS f2,1 AS RECVERSION,5637144576 AS PARTITION FROM CUSTTABLE T1 
LEFT OUTER JOIN HCMWORKER T2 ON ((T2.PARTITION=5637144576) AND (T1.MAINCONTACTWORKER=T2.RECID)) 
LEFT OUTER JOIN DIRPARTYTABLE T3 ON (((T3.PARTITION=5637144576) AND (T2.PERSON=T3.RECID)) 
AND (T3.INSTANCERELATIONTYPE IN (3738) )) WHERE (((T1.PARTITION=5637144576) AND (T1.DATAAREAID=N'atc')) AND (T3.NAME=N'John Daper')) 
AND EXISTS (SELECT 'CustTablePolicy' FROM CUSTTABLE T4 CROSS JOIN XDSCUSTTABLEREGULAR T5 
WHERE (((T4.PARTITION=5637144576) AND (T4.DATAAREAID=N'atc')) AND (T1.RECID=T4.RECID)) 
AND (((T5.PARTITION=5637144576) AND (T5.DATAAREAID=N'atc')) 
AND (((T5.USERGROUPID=N'FIN') OR (T5.USERGROUPID=N'test2')) AND (T4.ACCOUNTNUM=T5.CUSTACCOUNT)))) 
ORDER BY T1.MAINCONTACTWORKER"
 
when I try to remove the Employee Responsible filter from "records to include" tab and run the report it runs successfully..
and here's the succeeded query:
"INSERT INTO tempdb."DBO".t13749IISdvhd7481vm_718228_E46B6BA859E84F658642F5E53359DDEA (ACCOUNTNUM,GROUPID,RECVERSION,PARTITION) 
SELECT T1.ACCOUNTNUM AS f1,T1.CUSTGROUP AS f2,1 AS RECVERSION,5637144576 AS PARTITION 
FROM CUSTTABLE T1 WHERE (((T1.PARTITION=5637144576) AND (T1.DATAAREAID=N'atc')) AND (T1.ACCOUNTNUM=N'101100000001')) 
AND EXISTS (SELECT 'CustTablePolicy' FROM CUSTTABLE T2 CROSS JOIN XDSCUSTTABLEREGULAR T3 
WHERE (((T2.PARTITION=5637144576) AND (T2.DATAAREAID=N'atc')) AND (T1.RECID=T2.RECID)) 
AND (((T3.PARTITION=5637144576) AND (T3.DATAAREAID=N'atc')) AND (((T3.USERGROUPID=N'FIN') 
OR (T3.USERGROUPID=N'test2')) AND (T2.ACCOUNTNUM=T3.CUSTACCOUNT)))) 
ORDER BY T1.ACCOUNTNUM"
why in the query that fails "ACCOUNTNUM","GROUPID" is duplicated?!
Categories:
  • Verified answer
    AbdullahAhmed_ Profile Picture
    389 on at
    Customer Aging Report not working with XDS Policy
    I found the issue.. in the static query there are datasources..
    every datasource has a property called "Dynamic fields".. it was set to no, I set it to yes and it works!
  • AbdullahAhmed_ Profile Picture
    389 on at
    Customer Aging Report not working with XDS Policy
    After debugging I found the error is fired at class CustVendAgingCalculation
    at this line: "Query::insert_recordset(customersVendorsNoSorting, insertRecordsetMap, query);"

     
    The insertRecordsetMap is mapping the correct fields in class CustAgingCalculation:
     
     
    I still don't know why "ACCOUNTNUM","GROUPID" is duplicated in the insert statement?
  • AbdullahAhmed_ Profile Picture
    389 on at
    Customer Aging Report not working with XDS Policy
    Hi.. this is my policy and there are no related constrained tables.
     
     
    The error happens while running the report
  • André Arnaud de Calavon Profile Picture
    295,939 Super User 2025 Season 1 on at
    Customer Aging Report not working with XDS Policy
    Hi AbdullahAhmed,
     
    Can you share the technical details of your security policy? What is the exact primary table and what are other related constrained tables?
    Do you get the error while selecting the field in the advanced query, or when running the report?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 565

#2
Martin Dráb Profile Picture

Martin Dráb 536 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 402 Super User 2025 Season 1

Product updates

Dynamics 365 release plans