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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

OData query restricted to a subset of companies data.

(0) ShareShare
ReportReport
Posted on by 5

Hi AXers. 

I am looking for a solution for a setup issue I am facing. 

I am setting up an OData integration with a service account. The service account has been given the proper roles to access the entities that I want.

In our setup we have multiple legal entities, for this explanation say its A, B, and C. When the default company is set to A, I can do a query '[AX Resource]/data/PurchaseOrderHeadersV2/$count' and it brings back the proper count for that company.

When I do '[AX Resource]/data/PurchaseOrderHeadersV2/$count?cross-company=true' this also brings back the correct count of Purchase Order Headers. This is all working as it should, the next step is where I am running into the problem. 

I want to restrict the service account to only have OData access to company A and B but not C. When I go to Users > Users > Assign organizations and set A and B as "Grant access to specific organizations individually", this breaks the OData query entirely.  

I get the following error "User is not authorized to read view PurchPurchaseOrderHeaderV2Entity.  Request denied."

Is there a way to restrict the return data? Should I architect this integration a different way? Is there a way to restrict anything in OData?

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi James,

    What security roles are assigned to the service account? Also, are you getting this error only while running with the parameter "cross-company=true"?

  • Suggested answer
    jlwise Profile Picture
    5 on at

    It is a custom security role. I figured out the issue, when a default company is not included in the 'assigned organizations' that is when this issue it hit.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans