Skip to main content

Notifications

Announcements

No record found.

Finance forum
Suggested answer

Disable XDS policy

Posted on by 88
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... 290,558 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_ 88 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... 290,558 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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans