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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

XDS Policy query works with Tmp table but not with a regular table!

(1) ShareShare
ReportReport
Posted on by 521
I created a security policy with SalesTable as primary table and this is the query used for it:
 
 
I created a Tmp table that has one field only (SalesId) and it works fine and shows the data.. but when I created a regular table
with the same features.. It just doesn't show any data at all!
This is the code in the regular table methods: 
public class XDSSalesTableRegular extends common
{
    private void setRangesForSalesTable()
    {
        SalesTable           salesTable;
        XDSSalesTableRegular xDSSalesTableRegular;
        DYNADDVTable         dYNADDVTable;
        
        if(DYNADDVTable::userExistInUsers(curUserId()))
        {
            delete_from xDSSalesTableRegular;

            insert_recordset xDSSalesTableRegular(SalesId)
                select SalesId from salesTable
                    where salesTable.CustGroup == 'Free Cust'
                    &&    salesTable.InventLocationId == '101011121';
        }
    }
    
    public RefreshFrequency xds()
    {
        unchecked(Uncheck::XDS)
        {
            this.setRangesForSalesTable();
        }

        return RefreshFrequency::PerSession;
    }
}
 
I have the same question (0)
  • Martin Dráb Profile Picture
    239,996 Most Valuable Professional on at
    Your code makes little sense with a regular table, unless you limit the whole ERP system to a single user session. If there are two users, or even a single user with two sessions, the may block each other. For example, one user insert data to the table and before it gets used by XDS, it may get deleted by delete_from statement called from other user's session. This is simply a bad idea. In addition, it would be bad for performance.
     
    Or if you're mean that you already have the table populated with data, then you don't need all the code to populate it again, therefore you should throw it away. Having the table in the XDS query is sufficient.

    And if the table is temporary, you can throw away the delete_from statement, because the buffer will always be empty before you insert data into it.
  • Verified answer
    André Arnaud de Calavon Profile Picture
    306,250 Super User 2026 Season 1 on at
    Hi AbdullahAhmed,

    As Martin mentioned, an XDS method on a regular table will not create the records for the security policy. Either you need to have a regular table prefilled with data or you have a temporary table with the XDS method. Note that on the SQL server per user a temporary table will be created with their sales order IDs.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 414 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 352

#3
Martin Dráb Profile Picture

Martin Dráb 275 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans