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 :
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,284 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,284 on at

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

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader 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

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

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans