'OData API not loading all the legal entities data from fields

I have customized the new data entity to show the data from dynamics 365 to load in Power BI desktop to create new power Bi reports.

Have created the data entity with ProjTable as master data source and added child data sources which I required to add fields.

Fields which are added to my data entity all are showing data except two fields project manager and sales manager. Project and sales manager data is loading for my associated entity and not for all legal entities.

Please check the code and let me know if I'm missing anything here :

projTable = ProjTable::find(this.ProjId);
        this.ProjectManager = Hcm:;find(projTable.Worker.responsible).name;
    this.SalesManager   = HcmWorker::find(projTable.WorkerResponsibleSales).name();


Solution 1:[1]

make sure your ProjTable::find(this.ProjId) has the below syntax for crosscompany it not replace it to this

select firstonly crosscompany projTable where projTable.ProjId == this.ProjId;

Refer to this document: crossCompany keyword

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1