Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Disable record level security on a form in X++

Posted on by 1,416

Is there a way to disable record level security on a single form in X++? I tried doing the following on form datasource executeQuery method but it didn't work:

formDatasource_ds.query().recordLevelSecurity(false);
formDatasource_ds.queryRun().recordLevelSecurity(false);

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 288,513 Super User on at
    RE: Disable record level security on a form in X++

    Hi Muhammad,

    Are the tables on the datasource also used on other forms and part of the XDS policy?

    Another workaround would be creating a new view with the contents of the table you want to show unrestricted. The view is considered as a new table name and in this way you can bypass the XDS policy on the original table.

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,083 on at
    RE: Disable record level security on a form in X++

    Hi Muhammad,

    In this case, you need to consider if SaveDataPerCompany parameter. If it's enabled on the table used on the form, you need to activate cross-company selects.

    q.allowCrossCompany(true);

  • M Anas Khan Profile Picture
    M Anas Khan 1,416 on at
    RE: Disable record level security on a form in X++

    Hi Ludwig,

    Yes you are correct. This is kind of a contracting business requirement! There is custom inquiry form which should be global (cross-company), showing records from all companies. At the moment, customer assigns organisations at the user role level to restrict access to limited companies for a user. However for this particular form they want users to see data from all companies.

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Disable record level security on a form in X++

    Hello Muhammad,

    That is an interesting request. If I read this thread I wonder why you need XDS but not for a specific form? Is this an exception for a specific group of people that can use the form or what is the reasoning behind?

    Just curious ... :-)

    Ludwig

  • Blue Wang Profile Picture
    Blue Wang on at
    RE: Disable record level security on a form in X++

    Hi Muhammad Anas Khan ,

    Record-level security is bypassed in the following situations:

    1,Using display and edit methods

    2,Using FormListControl, FormTreeControl or TableListControl to show data

    3,Using a temporary table as a data source

    docs.microsoft.com/.../record-level-security

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 288,513 Super User on at
    RE: Disable record level security on a form in X++

    Hi Muhammad,

    Like Sergei mentioned, you can try the init method on the datasource or the form.

    There is also another command which can be used to enable or disable XDS: XDSServices.setXDSState

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,083 on at
    RE: Disable record level security on a form in X++

    Hi Muhammad,

    Have you tried to apply this code in the data source init method?

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,513 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,862 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans