Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Bypass the limited access to legal entities in "Assign Organizations" for user roles

(0) ShareShare
ReportReport
Posted on by 7,245 Super User 2025 Season 1
Hi

As you know in SysAdmin form, I can assign organization for a user role. This will cause the user to only see data for the organization he/she has access to.

Is there a way I can bypass this restriction?


Here's my scenario:

I created a form with three grids:


left grid, should show all companies (even if it was specified in /Assign organization/ that the user can't see specific companies), how can I do that? because currently it's showing only the companies that the user has access to and not all of them.

middle grid, should show the sites for the company I selected in the first grid

third grid, should show the addresses for the site selected in the second grid.

 
 
Here is the form datasources:
 
 
 
LogisticsLocation:/Link Type/= Delayed, / Cross Company Auto Query/ = No
LogisticsPostalAddress : OuterJoin with LogisticsLocation, / Cross Company Auto Query/ = No
CompanyInfo:  /Link Type/= Delayed, / Cross Company Auto Query/ = Yes
InventSite: /Link Type/= Delayed, / Cross Company Auto Query/ = Yes
 
Here is the code for the datasources:
 
  [DataSource]
    class CompanyInfo
    {
        public void init()
        {
            super();
            this.query().dataSourceTable(this.table()).clearDynalinks();
        }
        public int active()
        {
            int ret;
            Query query = InventSite_ds.query();
            query.clearCompanyRange();
            query.addCompanyRange(CompanyInfo.DataArea);
            InventSite_ds.executeQuery();
            element.executeQueryLogisticsLocation(tableNum(InventSite));
            ret = super();
           
            return ret;
        }
        /// <summary>
        /// Execute query of CompanyInfo DataSource
        /// </summary>
        public void executeQuery()
        {
            Query                query = new Query();
            QueryBuildDataSource qbdCompany;
            query.allowCrossCompany(true);
            qbdCompany = query.addDataSource(tableNum(CompanyInfo));
            element.addRangeToCompanies(qbdCompany);
            this.query(query);
            super();
            if(buyingLegalEntity)
            {
                CompanyInfo_ds.positionToRecord(CompanyInfo::findRecId(buyingLegalEntity));
            }
 
        }
    }
    [DataSource]
    class InventSite
    {
        public void init()
        {
            super();
            this.query().dataSourceTable(this.table()).clearDynalinks();
        }
        public int active()
        {
            int   ret;
            element.executeQueryLogisticsLocation(tableNum(InventSite));
            ret = super();
           
            return ret;
        }
    }
 
 
 
  • Waed Ayyad Profile Picture
    Waed Ayyad 7,245 Super User 2025 Season 1 on at
    Bypass the limited access to legal entities in "Assign Organizations" for user roles
    Hi Andre,

    " You can try to remove the statement with addCompanyRange as this is setting additional security."==== But I want to get the data from Invent site based on the active company 
     
     Query query = InventSite_ds.query();
    query.clearCompanyRange();
     query.addCompanyRange(CompanyInfo.DataArea);
     
    "the security framework will apply security filters per legal entity. " === Here you mean the restriction on security level will only return data from unrestricted legal entities? 
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,074 Super User 2025 Season 1 on at
    Bypass the limited access to legal entities in "Assign Organizations" for user roles
    Hi Waed,

    The contents of the CompanyInfo table are not restricted based on the organization assignment, unless you have a security policy (XDS) implemented on this table. You can try to remove the statement with addCompanyRange as this is setting additional security.
     
    Otherwise, the current behavior can be caused by the table InventSite as this table has a field to keep data separate per legal entity. Even though you have set this table to run cross-company, the security framework will apply security filters per legal entity. 
     
    In case you have an XDS policy on the CompanyInfo table, you can bypass that by creating a view with the CompanyInfo table as data source.
     
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Bypass the limited access to legal entities in "Assign Organizations" for user roles
    Hi Waed,
     
    For the first grid I would suggest you to create a table for that and insert all the companies details to that table - Use that table as a DataSource inside the form.
     
    Thanks,
    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,074 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans