Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Get the list of legal entities of a User

Posted on by 230

Hi All,

I need to find out the list of legal entites a User is having access to.

There is a chance of the user having multiple roles and also for each role it can have either specifc companies or all or have Organization hierarchy assigned,

Please suggest.

Thanks

Krishnendu

  • Krishnendu Profile Picture
    Krishnendu 230 on at
    RE: Get the list of legal entities of a User

    Andre...yes thanks ...it worked after starting a new session...also for both the tables SECURITYUSERROLE & SecurityUserRoleCondition the values updated after starting a new session.

    Thanks

    Krishnendu

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Get the list of legal entities of a User

    Hi Krishnendu,

    My bad, I intended to share indeed the table name UserDataAreaFilter.

    Did you add the organization hierarchy to a user via a security role? If so, ensure the security will be reloaded. Most simple for testing is closing the internet browser with the Dynamics 365 session and start a new session.

  • Krishnendu Profile Picture
    Krishnendu 230 on at
    RE: Get the list of legal entities of a User

    Hi Andre,

    I think the table your are are talking is UserDataAreaFilter and yes it contains all the legal entities.

    We have a crosscompany upload functionality where we have a company column based on which we update some tables.  If the user who is uploading doesn't have access it should throw error. Also the error log will have list of errored records so user with specific access to legal entities should be able to see the records.

    SecurityRights rights = SecurityRights::newUser(userId);

    container companies = rights.getSelectableCompanies();

    this works but I noticed one thing if we provide any organization hierarchy and grant it to a user it doesn't add those legalentites ...

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Get the list of legal entities of a User

    Hi Krishnendu,

    The table UserDataAreaList is having a list of companies per user. There are also options to retrieve the list with selectable entities via coding.

            SecurityRights rights = SecurityRights::construct();
    
            container companies = rights.getSelectableCompanies();

    Can you tell what you want to achieve? Then we can suggest the best option for you. Note that the System user role is not restricted and would cause providing a list with all legal entities.

  • Suggested answer
    Ramit Paul Profile Picture
    Ramit Paul 22,300 Most Valuable Professional on at
    RE: Get the list of legal entities of a User

    You can use SystemSecurityUserRoleOrganizationEntity data entity to get this list.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans