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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

XDS Security issue

(0) ShareShare
ReportReport
Posted on by 928

Problem: I want to set XDS Query in such a way that when it found zero rows it should return all possible values.

Details:

I got a requirement to have a single security Role to work with multiple security policies. 

Each policy got an especial column in custom security table from where it gets its parameters for XDS Query. Custom security table is a custom table which is like matrics to assign different warehouse, itemgroup etc to different users

Till now everything working fine. Now the client wants that if now warehouse is assigned to a user all warehouse data should be shown instead of no data. 

Is there any way I can achieve this by changing the XDS query to get all the record if no warehouse or itemgroup is assigned in the security table.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: Ax2012 XDS Security issue.

    It's a strange requirement, so solution would be strange as well. You can use temporary table that is populated in XDS method instead of using your setup table in the policy directly. Now you copy warehouses to the temporary table if any or copy all possible warehouses to the temporary table if setup table is empty.  You can read about XDS method in white paper www.microsoft.com/.../confirmation.aspx, it has references to existing examples in AX as well.

  • Mea_ Profile Picture
    60,284 on at
    RE: Ax2012 XDS Security issue.

    And check you tags they look wrong unless this question is related to everything you listed including 2 different version of the product.

  • Khurshid Wali Profile Picture
    928 on at
    RE: Ax2012 XDS Security issue.

    Thank you ievgen Miroshnikov for reply.

    where I can perform this task "Now you copy warehouses to the temporary table if any or copy all possible warehouses to the temporary table if setup table is empty" ?

    Is there any way to use CASE statement in AOT query?

  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Ax2012 XDS Security issue.

    Ok, let me try again, you obviously decided not to read anything.  You have AOT query that returns all available warehouses for a user and you use it in the policy. I assume that you have setup table that has warehouses available for a user and you use it in that query. Solution is to remove setup table from the query completely, create new temp table "MyWarehouses", define xds() method on it. In that method populate "MyWarehouses" with available warehouses for current user (take them from the setup table if it is not empty for current user; otherwise insert all). Use "MyWarehouses" in AOT query.

    That white paper talks about xds() method and RefreshFrequency and other things you need to know, but literally AX triggers that method for each user, so each user could have it's own data set and you can put X++ code to populate this data set in a way you like for each user.

  • André Arnaud de Calavon Profile Picture
    299,704 Super User 2025 Season 2 on at
    RE: Ax2012 XDS Security issue.

    Hi Khurshid,

    You can actually have a look at an example I did create in the past to secure by warehouse. It is then also filling an XDS construct table with allowed warehouses, but different compared to your requirement. Anyway, you can possibly learn from it: kaya-consulting.com/extensible-data-security-examples-secure-by-warehouse

  • Khurshid Wali Profile Picture
    928 on at
    RE: Ax2012 XDS Security issue.

    Thank You ievgen for detail explanation,

    I setup a temp table with the same properties as myaddressbookxds (default table) and xds method.

    But it is not working as expected. How can I debug? I am not getting anything in mywarehouseXDS (temp table) (after I made it regular just to test it is blank).

    XDS method is not invoking.

    Please help me with any documentation.

  • Mea_ Profile Picture
    60,284 on at
    RE: Ax2012 XDS Security issue.

    First of all you need to start from the version, you did not correct your tags so we have to guess if its 2012 or D365. Then give us some detail about query you have, mywarehouseXDS table properties  and code in XDS  method.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    299,704 Super User 2025 Season 2 on at
    RE: Ax2012 XDS Security issue.

    Hi Khurshid,

    If you make it a regular table, then it is not considered anymore to execute the xds() method. So, you have to keep it as temporary. You can share the coding of the XDS() method or debug yourself. See also another blog how to do debugging when logging on as a normal user: kaya-consulting.com/tips-on-ax-2012-security-development-tool-part-6

  • Khurshid Wali Profile Picture
    928 on at
    RE: Ax2012 XDS Security issue.

    5852.Capture.JPG

    Dear ievgen,

    I have corrected the tags and it is clearly written ax 2012.

  • Khurshid Wali Profile Picture
    928 on at
    RE: Ax2012 XDS Security issue.

    Thank you Andre,

    Here is the code

    I have keep it simple.

    public RefreshFrequency xds()

    {

       UserId                   currentUserId = curUserId();

       InventLocation inventLocation;

       MyWarehouseForXDS myWarehouseForXDS;

       ;

       insert_recordset myWarehouseForXDS(InventLocationId)

       select

           InventLocationId

       from inventLocation

       group by InventLocationId;

       return RefreshFrequency::PerSession;

    }

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
AlissonGodoy Profile Picture

AlissonGodoy 2

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans