How to Disable Grid Input Controls when Update is not Allowed for the Current User


In a Grid component if you have the Security Framework enabled and the user does not have permission to update data, the input controls are still enabled even though the user will not be able to save any edits. It might be desirable to disable input controls when the user does not have update permission.


Disabling editing controls in a Grid Component can be done by creating an Enable expression that calls a JavaScript function that checks if the user has permissions to edit record.

First, define the following JavaScript function in the component's Javascript Functions code section:

function enableControl(alias) {
    var obj = window[alias + '_GridObj'];
    var val = obj._editPermissions.allowUpdate;
    return val;
The {grid.object}._editPermissions's object of the Grid Object can be used to determine if add, update, or delete operations are allowed for the current user.

The enableControl() function takes the Grid alias as an input parameter. This allows the Grid object to be dynamically computed. If the enableControl() function had used:


Then you would run into trouble if you had multiple Grids that defined the function because the last Grid that was displayed would overwrite the previously defined global function and the {grid.object} placeholder would resolve to the last Grid displayed.

The enableControl() function can be called from any Grid component that you'd like to disable editing controls if the user doesn't have permissions to update record by adding the following expression for the Client-side Enable expression for each input controls (in either the Grid Part or Detail View Part):