Determines if you can write to a table.
Ok := RecordRef.WRITEPERMISSION
- Type: RecordRef The RecordRef that refers to a record in the table for which you want to know if you have write permission.
Property Value/Return Value
Specifies if you have permission to write to the table using any of the following RecordRef functions:
- INSERT Function (RecordRef)
- DELETE Function (RecordRef)
- MODIFY Function (RecordRef)
- DELETEALL Function (RecordRef)
true if you can write to some or all of the table; otherwise, false.
This function can test for both full write permission and a partial write permission that has been granted with a security filter. A write permission consists of Insert, Delete, and Modify permissions.
This function uses the filter that is currently applied to the RecordRef 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 in the range of the filter.
To determine whether the user has partial write 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 lets you 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.
This function works the same as the WRITEPERMISSION Function (Record).
The following example opens table 18 (Customer) and creates a RecordRef variable that is named MyRecordRef for the table. The WRITEPERMISSION function determines whether the table has write permission and stores the return value in the varHasWritePerm variable. The Customer table has write permission, so the message displays Yes. You can initialize the varTableNo variable with any table number. This example requires that you create the following variables and text constant in the C/AL Globals window.
|Text constant name||DataType||ENU value|
Does the %1 table have write permission? %2
varTableNo := 18; MyRecordRef.OPEN(varTableNo); varHasWritePerm := MyRecordRef.WRITEPERMISSION; MESSAGE(Text000, MyRecordRef.NAME, varHasWritePerm);