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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

XDS Query to restrict PurchTable to createdby

(0) ShareShare
ReportReport
Posted on by

Hello,

I have a requirement to restrict the PurchTable to only show PO's created by the current user, ie only show me POs created by 'me'. 

I'd like to do this via XDS with a security role of 'createdbymePOraiser' which has a query attached to it restricting to current user created POs. 

Can anyone help out with the structure of this query as I can't get the correct links between Dirpartytable/DirPerson etc. 

Any help would be much appreciated. 

Bruce

*This post is locked for comments

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

    Hi Bruce Wilson,

    Why do you need party at all ? You can create simple query with one table - PO and add a range for createdBy field by current user using SysQueryRangeUtil::currentUserId(), so only PO created by current user would be available. 

    Or under user you mean worker ?

  • Community Member Profile Picture
    on at

    Hi Ievgen,

    Maybe I had been over complicating it by looking at dirpartyuser.

    I have created a query "bwtestcreatedby": Data Source PurchTable, dynamic fields = "Yes", Range Createdby = CurUserId().

    And a security Policy as per screenshot below

    Createdbypolicy.PNG

    However, when I go to view all purchase orders, it is showing me nothing, just a blank table. 

    Am I missing something as I've followed the same steps as I normally would for XDS policies, which are working. 

    Again, any help would be appreciated. 

    Bruce

  • Mea_ Profile Picture
    60,286 on at

    Do you have created by field enabled on PO table?

  • Community Member Profile Picture
    on at

    Hi,

    Sorry for not replying yesterday. I was missing the final closed bracket on the (currentuserid)).

    XDS now working but have come across a secondary issue. If the XDS policy is active and a person who is both a Purchase Order creator and approver, cannot approve Purchase Orders created by other users as they don't have access to the Purchase Order table, so going to have to re-think this as we have a number of users who have the ability to both raise and approve Purchase Orders.

    Can't actually think of a way around it at the moment.

    Bruce

  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    You can turn off XDS in WF code.

  • add Profile Picture
    on at

    Hello guys,

    Please help me understand correctly. Bruce has created a role that restricts access to users to see only POs created by them. After that he discovers that some users have to not only create but also approve POs, so they must not be in the restricted group. My question is wouldn't it be simplest to just not include those users (the "approvers") in the role with the restriction rule?

  • Mea_ Profile Picture
    60,286 on at

    Hi add,

    That's another option, but in this case restrited user should never be approver :)

  • Community Member Profile Picture
    on at

    This is correct, I actually knew that some of the PO raisers were also approvers but hadn't thought about this from a workflow perspective. The workflows cannot progress because the XDS policy restricts the users access to the PurchTable. So as Ievgen has said, I'm going to need to do some work to stop the security policy from interfering with the workflow.

    Due to the structure of what I am working with the PO raisers may also be approvers for their own budget centers, but when they are raising POs they are not required to see any other departments POs - for confidentiality reasons.

    The restricted user must be able to approve Purchase Orders created by other users.

    I need to look into the suggestion made by Ievgen yesterday about switching off the policy for WF's.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
Basit Profile Picture

Basit 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans