Skip to main content

Notifications

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

Disable XDS policy

(1) ShareShare
ReportReport
Posted on by 190
I created a security policy and I want the admin to run a batch that can disable it...
 
[SysOperationJournaledParametersAttribute(true)]
final class DYNADDVDisableBatch extends SysOperationServiceController
{
    public ClassDescription defaultCaption()
    {
        return "Disable Data Validation";
    }

    public void new()
    {
        super(classStr(DYNADataValidationClass),methodStr(DYNADataValidationClass,disableXDS),SysOperationExecutionMode::Synchronous);
    }

    public static DYNADDVDisableBatch construct(SysOperationExecutionMode _executionMode = SysOperationExecutionMode::Synchronous)
    {
        DYNADDVDisableBatch controller = new DYNADDVDisableBatch();
        controller.parmExecutionMode(_executionMode);
        return controller;
    }

    public static void main(Args _args)
    {
        DYNADDVDisableBatch controller = DYNADDVDisableBatch::construct();
        controller.parmArgs(_args);
        controller.startOperation();
    }

}
and this is disableXDS method code:
 
public void disableXDS()
    {
        unchecked(Uncheck::XDS)
        {

        }
    }
what's missing?!
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,359 Super User 2024 Season 2 on at
    Disable XDS policy
    Hi Abdullah,

    No, this will not work. It will only disable coding in the block. If a user opens the sales orders, it is not part of the unchecked block and the policy remains active. Can you tell me if the policy is your customization or part of an ISV solution? If it is a customization, can you share some details of the policy and the related query linked to the policy?
  • AbdullahAhmed_ Profile Picture
    AbdullahAhmed_ 190 on at
    Disable XDS policy
    So, what you mean is... The policy used in the Unchecked will be bypassed.. I have a policy that restrict access to all sales orders and I want the admin to turn it off across the whole system.
     
    So, I would use for example the salesTable in the Unchecked and  It should work fine?
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,359 Super User 2024 Season 2 on at
    Disable XDS policy
    Hi,

    Can you elaborate on the business requirement? Enabling or disabling a policy can be done by the model ownder in Visual Studio. There are two options where non-admin users can bypass XDS policies. I wrote 2 blogs about that:
     
     
    In case you expect that all XDS policies are disabled by using the statement unchecked, then this is not working. The policies used when executing coding within the unchecked block will be bypassed. This unchecked statement is not a generic switch.

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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans