Skip Business Rules for Sys Admins (Classic UI)

Hello Community,

Is there any way to skip business rules (ex required fields) when you are a SysAdmin in classic UI pages? Any code snippet that could work?

Sasor

Like 0

Like

1 comments

Hello Sasori,

There’s no out-of-the-box way to skip or disable business rules (like required fields) at runtime in classic UI pages. Business rules are applied when the page loads, and you can’t really turn them off or change them dynamically once they’re active.

If you need this kind of flexibility, the better approach is to avoid using business rules for those fields and instead handle the validation in code. For example, you can check if the current user is a SysAdmin at runtime:

define("UsrTest1Page", ["RightUtilities"], function(RightUtilities) {

...

    methods: {
    onEntityInitialized: function() {
        this.callParent(arguments);
        var vm = this;

        RightUtilities.checkCanExecuteOperation({
            operation: "CanManageUsers"
        }, function(result) {
            if (result === true) {
                vm.addColumnValidator("UsrString1", function() {
                    return { invalidMessage: "" };
                });
                
            } else {
                vm.addColumnValidator("UsrString1", function(value) {
                    if (!value) {
                        return {
                            invalidMessage: "This field is required."
                        };
                    }
                    return {
                        invalidMessage: ""
                    };
                });
            }
        });
    }
},
With this approach, you can decide in code when a field should be required (or not) and apply your own custom validators. This gives you full control over the behavior without relying on business rules that can’t be changed on the fly.

Show all comments