Skip to main content

Notifications

Microsoft Dynamics AX forum
Answered

Cross company view

Posted on by 3,538

I need a cross company view of some table. (For reasons)

I read somewhere on Microsoft docs that a view cannot be cross company. Is that correct? (I tried finding my source without success.)

If I am correct, my second question is:

2) Why is that property available? For reference: On the node View Metadata there is a property Allow Cross Company.

Then I solved this apparent issue by creating a view, ViewA of QueryA with TableA as root datasource. Then I created a cross company query of ViewA, ViewAQueryCrossCompany. And then a view of the last mentioned query. Is there a "better" solution? (As I created two views and a two queries of TableA, just to get one View.)

I am new to Views, very limited experience..... (Yes I have read the Microsoft docs page.) So maybe I'm not getting something. And maybe my question is "wrong". The point is as I mentioned in the first line, I need a cross company view of tableA.

Thanks for reading

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 227,954 Super User 2024 Season 2 on at
    RE: Cross company view

    Yes, "Open in Excel" is based on data entities and therefore not a query. Therefore you want an entity with cross-company behavior. It would have helped if you mentioned it at the beginning.

    The documentation is again able to help. Please check out Development for data entities > Cross-company behavior

  • Pete Alberts Profile Picture
    Pete Alberts 3,538 on at
    RE: Cross company view

    Last question.

    Martin you mentioned that "... Allow Cross Company = True and when you're using the view ... ". Does this imply that if I cross-company query a view that has the property set to "no", I will not get the desired results or will a cross company query of a view be cross company regardless of the mentioned property?

  • Pete Alberts Profile Picture
    Pete Alberts 3,538 on at
    RE: Cross company view

    Thanks Nikolaos Mäenpää, that was the page I was referring to.

    Martin I think I get it (I need to get used to the fact that a view is more or less a table).

    I have been tasked with a cash flow add-in. (Yes there is existing cash-flow functionality - I'm just following orders from the boss.)

    What my boss wants is a list of records that influence cash flow. It needs to be able to "Open in excel" and real time. In other words the source needs to be a query. And I need an entity for "Open in Excel" and for that I need a view. I am working with a bunch of things that are new to me, so I am scared that the cross-company part gets lost somewhere down the line.

    For example I have queries for all the relevant tables, then views for those queries (to create some Computed Columns), then a union query to join all the views;;;; then a view of the union query and finally an entity of that view. And on all the elements there is the Cross-Company option - so I was scared that the fact that views cannot be cross-company (what I previously incorrectly understood) will jeopardise the whole operation. But I understand now.... :)

    Thanks all.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 227,954 Super User 2024 Season 2 on at
    RE: Cross company view

    This is the normal usage:

    Create a view Allow Cross Company = True and when you're using the view, query it in the same way as if you're using a table and you want to get cross-company behavior. For example, use Cross Company Auto Query in a form, crossCompany keyword in select statements etc. It's really the same as using tables.

    What situation are you in that you can't do it this way?

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Cross company view

    Please see this documentation: [View:https://docs.microsoft.com/en-us/dynamicsax-2012/developer/cross-company-queries-for-views]

    A view can allow cross company queries, but just like with tables, the cross company "intention" must be explicitly specified when reading from the view.

    In your case, I guess you could just forget about the view and create a cross company query / select statement into your table.

Helpful resources

Quick Links

Dynamics 365 Community Update

Welcome to the inaugural Community Platform Update. As part of our commitment to…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Community Spotlight of the Month

Kudos to Mohana Yadav!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,107 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,954 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans