web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Error in reports when applying XDS

(1) ShareShare
ReportReport
Posted on by 485
I created a xds policy on CustTable.. the system restricts the forms and the reports according to data related to CustTable, Ex:- All Customers form shows only specific customer, etc..
 
When I open Customer aging report.. the report works fine, when I go to "records to include" tab I find 2 default filters (Customer account and customer group) when I enter values in these fields and generate the report.. everything works fine.
 
 
The problem occurs when I filter using another field:
 
 
I get these errors:
1- "Cannot insert multiple records in Customer or vendor account number (CustVendTransAging). The SQL database has issued an error.
 
2- "[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The column name 'ACCOUNTNUM' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code."
 
3- "INSERT INTO tempdb."DBO".t13749IISdvhd10039vm_710304_1353304698FA4561968F38250A4E8450 (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'adc')) AND (T3.NAME=N'Jonathan McAdams')) AND EXISTS (SELECT 'CustTablePolicy' FROM XDS_CUSTTABLE T4 WHERE (((T4.PARTITION=5637144576) AND (T4.DATAAREAID=N'adc')) AND (((T4.USERGROUPID=N'FIN') OR (T4.USERGROUPID=N'test2')) AND (T1.ACCOUNTNUM=T4.CUSTACCOUNT)))) ORDER BY T1.MAINCONTACTWORKER"
Categories:
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,194 Super User 2025 Season 2 on at
    HI Abdullah,
     
    Can you provide some information about how you created the policy? What is the primary table and how did you define the query for the security policy? 
  • AbdullahAhmed_ Profile Picture
    485 on at
    Hello, Mr. Andre...
     
    It's a normal query joining 2 tables... the XDS_CustTable table is a regular table:
     
     
    and here's the policy:
     
  • Raj Borad Profile Picture
    1,428 on at
     
    I recommend you switch the Join Mode in XDS_CustTable to NoExistsJoin or InnerJoin and test again. ExistsJoin is prone to such SQL duplication issues when the main table is also joined elsewhere.
     
    Try to enable "Use Role Name" if multiple user groups are in scope; this helps filter cleanly.
     
    You can also test your policy query (SysQuery) to verify there is no field conflict before it's used in the reporting logic.
     
    Thanks,
    Raj D Borad
  • AbdullahAhmed_ Profile Picture
    485 on at
    Thank you raj for the response,
     
    I don't think innerJoin is going to make a difference than existsJoin... but how can I test the query from SysQuery? 
     
    Note that the query returned the cause the error is correct and returns the desired result when run on sql server. 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 467 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 420 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 241 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans