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 :
Microsoft Dynamics AX (Archived)

Query for policy

(0) ShareShare
ReportReport
Posted on by 40

Hello,

need some help with one issue.

I have Query AOT that I using in Policy. Problem is that i have one dynamic range for one of tables. I should add current user id to range value.

I tried to solve it by setting rangeField in init method, but policy execute pure query (do not invoke init method). 

Is there a change to put method into range parameter or any other ways to solve this problem?

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,286 on at

    Did you try SysQueryRangeUtil::currentUserId() ? You can read about SysQueryRangeUtil usage here blogs.msdn.microsoft.com/.../using-dynamic-query-values-sysqueryrangeutil-in-dynamics-ax

  • Skribl Profile Picture
    40 on at

    Nope it do not work. I need to put some dynamic value in Datasource range node.

  • Mea_ Profile Picture
    60,286 on at

    It would be helpful if you tell us more, like do you have any error or what?

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    a workable way that i have done in past was

    1) creating a table that has refresh frequency per session. You can find many table named as e.g. MyLegalEntities etc. similarly you can create a table named MyUserId. Keep refresh frequency per session.

    2) in your query make a join with MyUserId (Table)

    3) use your query in Security Policy

    if you will follow the white paper from Microsoft, that has example based on similar architecture  

  • Verified answer
    Skribl Profile Picture
    40 on at

    Sorry,

    SysQueryRangeUtil::currentUserId() worked. Thank you ;)

    i put class method directly in datasource range node as (SysQueryRangeUtil::currentUserId()).

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 Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
Nagendra Varma K Profile Picture

Nagendra Varma K 4

#2
Harisgillani Profile Picture

Harisgillani 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans