Determines whether a user can write to a table. This function can test for both full write permission and partial write permission that has been granted with a security filter. A write permission consists of Insert, Delete, and Modify permissions.
Ok := Record.WRITEPERMISSION
- Type: Record A record in the table from which you want to determine if you have write permission.
Property Value/Return Value
Specifies whether you have permission to write to the table using any of the following record functions:
- INSERT Function (Record)
- DELETE Function (Record)
- MODIFY Function (Record)
- RENAME Function (Record)
- DELETEALL Function (Record)
- MODIFYALL Function (Record)
true if you can write to some or all of the table. false if you cannot write to the table.
This function uses the filter that is currently applied to the Record to determine whether you have write permission. If no filter is applied, the function tests for full write permission. If a filter has been set, the function only tests for write permission within the range of the filter.
To determine whether the user has a partial read permission, because a security filter has been applied, view the Permissions page. For more information, see How to: Set Security Filters.
If you do not have permission to write to a table and you attempt to write, a run-time error occurs. This function allows you to determine in advance if you have write permission. When the permissions are checked, the combination of permissions in the license file and the user's permissions in the Permission table is considered.
The following example uses a record from the Vendor table to check whether the user is granted write permission to the Vendor table. The return value from the WRITEPERMISSION function is stored in the varHasWrite variable and displayed in a message box. The value, Yes is displayed because the user can write to the Vendor table. This example requires that you create the following variables in the C/AL Globals window.
MyRecord.GET('10000'); varHasWrite := MyRecord.WRITEPERMISSION; MESSAGE('Table has Write permission? %1', varHasWrite);