Question

button visibility for different section

Hi Team
Case 1: suppose I am login as Supervisor on that time in candidate entry section new button has visible.
Case 2: Suppose if am login as another user like portaluser on that time in candidate entry section New button should not visible.for which process I have to follow.
please find the attachment below.
Hoping for a positive reply.

regards
manikanta.

Like

6 comments

Hello manikanta,

Please find the similar article except the button name here:
https://community.bpmonline.com/questions/hide-actions-and-tag-button-section
In your case, button name is "SeparateModeAddRecordButton" and it will look like this:
define("AccountSectionV2", [], function() {
    return {
        entitySchemaName: "Account",
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[
            {
                "operation": "merge",
                "name": "SeparateModeAddRecordButton",
                "values": {
                    "visible": false
                }
            }]/**SCHEMA_DIFF*/,
        methods: {}
    };
});

Alex_Tim,

Hi, Alex,
I am Trying in this way to hide the New Button in Portal User but it's still Not working please check the code once and help me.

code:
   {
                "operation": "merge",
                "name": "SeparateModeAddRecordButton",
                "parentName": "DataGrid",
                "propertyName": "activeRowActions",
                "values": {
                    "className": "Terrasoft.Button",
                    // new caption
                    "caption": "New",
                    "visible": {"bindTo": "getUserRights"}
                    }
            },
methods: {
                getUserRights: function() {
                var status="true";
                var currentUser = Terrasoft.SysValue.CURRENT_USER.value;
                var Adminuser="610d1a6f-dde8-40cc-aa1f-2b547dd239f3";
                if(Adminuse!==currentUser)
                {
                status=false;
                }
                else
                {
                status=true;
                }
                return status;
    }
}

manikanta,

It seems that getUserRights function will not update the visibility of the button because it does not have operations like this.get() or this.set()

I recommend to set the value to the virtual attribute and bind visibility property to the attribute.

Regards,
Alex

Alex_Tim,

HI, Alex is this the correct way to put this .while I am inserting this code its not working  please check the code once, please

             {
                "operation": "merge",
                "name": "SeparateModeAddRecordButton",
                "parentName": "DataGrid",
                "propertyName": "activeRowActions",
                "values": {
                    "className": "Terrasoft.Button",
                    // new caption
                    "caption": "New",
                    "visible": {"bindTo": "getUserRights"}
                    }
            },
        ]/**SCHEMA_DIFF*/,
        methods: {
                setValidationConfig: function() {
                // Calls the initialization of validators for the parent view model.
                    this.callParent(arguments);
                // The phoneValidator() validate method is added to the [Phone] column.
                    this.addColumnValidator("610d1a6f-dde8-40cc-aa1f-2b547dd239f3", this.getUserRights);
                },
                getUserRights: function() {
                //    var scope = this;
                var status="true";
                var currentUser = Terrasoft.SysValue.CURRENT_USER.value;
                var Adminuser="610d1a6f-dde8-40cc-aa1f-2b547dd239f3";
                if(Adminuser!==currentUser)
                {
                status=false;
                }
                else
                {
                status=true;
                }
                return status;
                }
}
};

 

or else please send me one sample on how to achieve this task

Hoping for a positive reply.

 

manikanta,

Hi Alex in this method also I am trying but I am getting output please check once

        methods: {
setIsEditTemplateButtonVisible: function(scope) {
var select = Ext.create("Terrasoft.EntitySchemaQuery", {
    rootSchemaName: "SysAdminUnit"
});
 
select.addMacrosColumn(Terrasoft.QueryMacrosType.PRIMARY_COLUMN, "610d1a6f-dde8-40cc-aa1f-2b547dd239f3");
select.addColumn("ConnectionType");
 
var filters = Ext.create("Terrasoft.FilterGroup");
filters.addItem(select.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "610d1a6f-dde8-40cc-aa1f-2b547dd239f3",
    scope.Terrasoft.SysValue.CURRENT_USER.value));
select.filters = filters;
 
select.execute(function(response) {
    if (response.success) {
        if (response.collection.getCount()) {
            var connectionType = response.collection.getByIndex(0).get("ConnectionType");
            if(connectionType === 1){
                scope.set("SeparateModeAddRecordButton", false);
            }else{
                scope.set("SeparateModeAddRecordButton", true);
            }
        }
    }
}, this);
}
}};

manikanta,

Hi Alex

 

Log in or register to comment