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?