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

Cross company delete_from operation is allowed only for admins.

(0) ShareShare
ReportReport
Posted on by 5

Hi

I have a requirement where cross company delete_from (inline) query is being executed. It successfully executes is SysAdmin role and throws the following error "Cross company delete_from operation is allowed only for admins" if I try to execute it from different role.

What can be possible solution from security perspective.

I have the same question (0)
  • Blue Wang Profile Picture
    on at

    HI Saad,

    How about your code?

    while select crosscompany table_name
    {
       while dataArea
        {
           changecompany (dataArea.id)
           {
              delete_from ...
           }
        }
    }

  • saad486 Profile Picture
    5 on at

    The code I am currently working is in this form

    delete_from crosscompany Table1
        join ..............
        ..............

    Sadly, I am not allowed to change things on code level, hence restructuring of Query is out of question.

    What I am specifically looking for is solution using security privilege, duty or role. I have tried tweaking properties in security privilege like giving table level permission to all the tables involved in this query and it has not worked.

  • Suggested answer
    Shashanks Profile Picture
    230 on at
    Hi saad,
    can you try putting you code inside below code and check if it works, It by passes the security permission on the table for the code executing inside.
    unchecked(uncheck::TableSecurityPermission)
            {}
    Hope this helps.Do Let us know if it works.
    Regards,
    Shashank Shekhar
    This post is my own opinion and does not necessarily reflect the opinion or view of my company or Microsoft.
    Please mark as verified if the answer is helpful.
  • Community Member Profile Picture
    on at
    [quote user="Shashanks"]
    Hi saad,
    can you try putting you code inside below code and check if it works, It by passes the security permission on the table for the code executing inside.
    unchecked(uncheck::TableSecurityPermission)
            {}
    Hope this helps.Do Let us know if it works.
    Regards,
    Shashank Shekhar
    This post is my own opinion and does not necessarily reflect the opinion or view of my company or Microsoft.
    Please mark as verified if the answer is helpful.
    [/quote]

    Hey Shashank,

    I have the same issue. Using the unchecked(uncheck::TableSecurityPermission) {} did not resolve the problem, I'm still getting the same error "Cross company delete_from operation is allowed only for admins".

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Well, if the system says that it's only allowed for admins, then it's only allowed for admins. So if a non-admin must run this code, you must run it company per company, not in a single statement. If you wish that Microsoft would allow this functionality for non-admins in the future, you can post an idea on https://ideas.dynamics.com

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... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans