Share via


WRITEPERMISSION Function (Record)

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. The WRITEPERMISSION functions checks for both direct and indirect permissions on these operations.

Syntax

  
Ok := Record.WRITEPERMISSION  

Parameters

Record
Type: Record

A record in the table from which you want to determine if you have write permission.

Property Value/Return Value

Type: Boolean

Specifies whether you have permission to write to the table using any of the following record functions:

Remarks

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.

Example

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.

Variable name DataType Subtype
MyRecord Record Vendor
varHasWrite Boolean Not applicable
  
MyRecord.GET('10000');  
varHasWrite := MyRecord.WRITEPERMISSION;  
MESSAGE('Table has Write permission? %1', varHasWrite);  

See Also

Record Data Type