web
You’re offline. This is a read only version of the page.
close
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 9,039 Super User 2025 Season 2
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
    237,978 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
    301,168 Super User 2025 Season 2 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,039 Super User 2025 Season 2 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,039 Super User 2025 Season 2 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,827 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,039 Super User 2025 Season 2 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,039 Super User 2025 Season 2 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,827 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
    237,978 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,039 Super User 2025 Season 2 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 422 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans