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

Legal entity range in AOT View

(1) ShareShare
ReportReport
Posted on by 8,662 Super User 2025 Season 1
Hi All,
 
I want to return data from worker only from current legal entity, can I add range on dataArea field on view?
  • Waed Ayyad Profile Picture
    8,662 Super User 2025 Season 1 on at
    Legal entity range in AOT View
    Hi Martin,
    I tried currentLegalEntity on View to be as a range for the legal entity, but it returns Dat legal entity. I need when I open the Company A to get data from Company A, if I change to Company B to get data from company B.
     
     
    Regards,
    Waad
  • Suggested answer
    Martin Dráb Profile Picture
    234,595 Most Valuable Professional on at
    Legal entity range in AOT View
    Waed, you surely add ranges to view, but if have three companies and you filter the view by single company, it'll never return any data for the remaining two companies. I doubt it's what you want.
     
    If you used currentLegalEntity() as a range in a view definition, the method would run at DB synchronization and the view would contain hard-coded filter for this single legal entity ID.
     
    But if you use currentLegalEntity() as a range in a query, it'll be interpreted when running the query and you'll get a filter based on which company you're logged in.
  • GirishS Profile Picture
    27,825 Moderator on at
    Legal entity range in AOT View
    You can add a range in the view also. There is no restriction.
    Also, there is a range node available in the Data entity also. You can try adding the range there also.
     
    Thanks,
    Girish S.
  • Waed Ayyad Profile Picture
    8,662 Super User 2025 Season 1 on at
    Legal entity range in AOT View
    Hi Martin,
     
    "
    A view doesn't have a "current" legal entity - that depends on user session, not on the view definition in SQL database.
     
    Either add a range at runtime, or create an AOT query and use (CompanyInfoHelper::currentLegalEntity()) as the filter value (don't forget the parenthesis)."
     
    you mean I can't use range on View? How can I achieve it at runtime? 
     
     
  • Waed Ayyad Profile Picture
    8,662 Super User 2025 Season 1 on at
    Legal entity range in AOT View
    Hi GirishS,
     
    IS it not possible to add range on AOT View.
     
    Also If I need to create data entity to return current company worker how can I achieve this?
  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    Legal entity range in AOT View
    Hi Wayed,
     
    There is already standard query available for this with current company filter.
    HcmWorkerListPage_Employees. Refer to the below screenshot.
     
    Thanks,
    Girish S.
  • Waed Ayyad Profile Picture
    8,662 Super User 2025 Season 1 on at
    Legal entity range in AOT View
    Hi Andre,
     
    Yes I want to get all worker in the current company, but I tried to add range in the below image, but no data is returned.
     
  • Waed Ayyad Profile Picture
    8,662 Super User 2025 Season 1 on at
    Legal entity range in AOT View
    Hi Martin,
     
    Can I add range on data area field on Company info data source by joining it with HcmEmployment ?
     
  • André Arnaud de Calavon Profile Picture
    295,829 Super User 2025 Season 1 on at
    Legal entity range in AOT View
    Hi Waed,
     
    You didn't provide that much of detail, but I assume you want to have a list of workers belonging to a specific legal entity. This is stored in the Employment table (HCMEmployment). You can join this table with the worker details. 
  • Suggested answer
    Martin Dráb Profile Picture
    234,595 Most Valuable Professional on at
    Legal entity range in AOT View
    HcmWorker doesn't have any DataAreaId to filter by. What you can do is joining it with HcmEmployment table, which is also shared, but it has LegalEntity field that you can utilize. You could also use HcmWorkeerLegalEntity view.
     
    A view doesn't have a "current" legal entity - that depends on user session, not on the view definition in SQL database.
     
    Either add a range at runtime, or create an AOT query and use (CompanyInfoHelper::currentLegalEntity()) as the filter value (don't forget the parenthesis).

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 565

#2
Martin Dráb Profile Picture

Martin Dráb 536 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 402 Super User 2025 Season 1

Product updates

Dynamics 365 release plans