web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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 9,135 Super User 2026 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?
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,511 Most Valuable Professional on at
    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).
  • André Arnaud de Calavon Profile Picture
    304,837 Super User 2026 Season 1 on at
    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. 
  • Waed Ayyad Profile Picture
    9,135 Super User 2026 Season 1 on at
    Hi Martin,
     
    Can I add range on data area field on Company info data source by joining it with HcmEmployment ?
     
  • Waed Ayyad Profile Picture
    9,135 Super User 2026 Season 1 on at
    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.
     
  • Suggested answer
    GirishS Profile Picture
    27,843 Moderator on at
    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
    9,135 Super User 2026 Season 1 on at
    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?
  • Waed Ayyad Profile Picture
    9,135 Super User 2026 Season 1 on at
    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? 
     
     
  • GirishS Profile Picture
    27,843 Moderator on at
    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.
  • Suggested answer
    Martin Dráb Profile Picture
    239,511 Most Valuable Professional on at
    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.
  • Waed Ayyad Profile Picture
    9,135 Super User 2026 Season 1 on at
    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 664

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 615 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 550

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans