Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Cross company behavior with OData - not all company

Posted on by Microsoft Employee

Hi everyone!

The environment is D365 Finance and Operation online.

I have created some new data entities for a special report purpose. I have created the proper privileges and roles too.

The Primary Company Context property is empty.

We have more then 20 companies in the test environment.

When I use these entities in an OData query (Power Query in excel, or Power BI) I get the expected data for all company.

But if I assign only 2 organizations to the roles within the AX I get the following message when I refresh the query:

DataSource.Error: OData: Request failed: The remote server returned an error: (400) Bad Request. (An error has occurred.)
Details:
DataSourceKind=OData

I have the same issue with the default entities and the default roles too.

Basically my question is:

How can I query the data of companies that the user has access to. But not only the data of the default company and not the data of all company.

Thanks

Csaba

*This post is locked for comments

  • Suggested answer
    guk1964 Profile Picture
    guk1964 10,877 on at
    RE: Cross company behavior with OData - not all company

    Maybe it will be easier to do it for all companies and then add filters in Excel or PBI to slice data, or to print off reports for specific combinations of companies.

    Different combinations of 20x 19 x 18 x17....... etc reports is clearly not a sensible option.

    Maybe something  Microsoft needs to think about for what is after all, a Global, Enterprise solution

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cross company behavior with OData - not all company

    Hi,

    Any luck in finding a solution?

    I'm having the same problem and am getting pretty desparate...

    using D365FO 10

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cross company behavior with OData - not all company

    Hi,

    Any luck in finding a solution?

    I'm having the same problem and am getting pretty desparate...

    using D365FO 10

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cross company behavior with OData - not all company

    Adding "?cross-company=true" used to work.  However, with the new [Implementation="2.0"] it no longer does.  I have not yet been able to find a way to pull all or multiple legal entities when using [Implementation="2.0"].  Which is a shame as it otherwise would help speed up queries.

    Using D365FO 7.1 (about to roll up to 7.3)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cross company behavior with OData - not all company

    Hi Aalok,

    Unfortunately not yet.

    I'm still looking for the solution.

    This seems to be a bad approach.

    Regards,

    Csaba

  • Aalok Profile Picture
    Aalok on at
    RE: Cross company behavior with OData - not all company

    Hi,

    Is this issue resolved? I'm also facing similar issue.

    Regards,

    Aalok

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Cross company behavior with OData - not all company

    I'm not aware of a way how you can achieve this, If I were you I would log a request with MS to see what they say.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cross company behavior with OData - not all company

    Hi ievgen Miroshnikov

    thanks for your reply.

    I guess I read almost all the stuff that appeared on this topic in Google's search.

    I tried earlier the solution you mentioned but it is not the best for me.

    As I wrote we have more than 20 companies and I have to manage automatically the users's access to different companies .

    Otherwise I have to create 16-20 different reports to different users who have access to 1, 2 or 3 different companies. And I have to change the code in every case when our customer changes the user access rights in AX.

    Besides it means to me everyone who get the excel file will able to change the code and will able to see any other company's data. That's what I want to avoid.  This is not safe.

    So, I think my question is still remain.

    I would add a new one:

    Why do I get the error message (see above) if the role is assigned with more (but not all) individual organizations. Regardless of whether it is a default or a customized entity.

    Thanks

    Csaba

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Cross company behavior with OData - not all company

    Hi CsabaKis,

    According to documentation docs.microsoft.com/.../odata

    "To filter by a particular company that isn't your default company, use the following syntax: http://[baseURI\]/data/FleetCustomers?$filter=dataAreaId eq 'usrt'&cross-company=true"

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans