How do I Prevent a User from updating a specific field?

How do I Prevent a User from updating a specific field?

You should create a Screen Data Script.  The following example prevents a User from updating the AdditionalField_1 field in the Job Order Header.  This script first obtains the Order Number and AdditionalField_1 values from the current displayed record (which is still in memory and not yet posted to the database).   It then gets the current value of AdditionalField_1 from the database.   We then state that if the current user is GENERAL and the (memory) AdditionalField_1 content is different to the Database AdditionalField_1 then return an error message and abort the update.

Therefore create a Screen Data Script with the following:


varCurrentOrder: String; CurrentAdd1: String; Addfield1: String;

begin    CurrentOrder := QueryValue('ORDERNUMBER');    Addfield1 := QueryValue('ADDITIONALFIELD_1');   CurrentAdd1 := GetStringFromTable('JOBHEADER','ADDITIONALFIELD_1','ORDERNUMBER',CurrentOrder); If (((CurrentUser = 'GENERAL') or (CurrentUser = 'JOE')) and (CurrentAdd1 <> AddField1)) then    Begin     Showmessage('You are not allowed to amend this field');     Abort;    end   else   Begin    end; end.

 

The next step is to go into File>System Configuration>Screen Data Script and add a record containing

Screen: Job OrdersTable

Name: Job Header

SQLType: Update

Script: The above script name

 

    • Related Articles

    • Controlling Users Updating / Adding or Deleting records

      From time to time you may wish to stop an individual or group of users the ability to add / update or delete records in Ostendo, whilst still giving them access to specific functions within Ostendo. In this example we will prevent a user 'GENERAL' ...
    • How do I prevent a User from amending a list screen layout?

      Go into File>System Configuration>User Security and Options and click on the ‘User Options’ tab. Two options are available: ‘Check’ the ‘List Customizing’ checkbox to prevent the user form adding extra fields to the list ‘Check’ the ‘Save Grid ...
    • How do I prevent financial entries to prior or later periods?

      You can prevent financial entries prior to a user-specified date by going into File>Financial Configuration>Cutoff dates. There are three separate dates; each covering a specific area. These are: - Order, Order Transactions, and Inventory - Supplier ...
    • How can I force a specific printer for a user

      Lets say your in the Demo Company. and you want specific reports for the ADMIN user to go to "Printer 2" 1) Create a new Folder under the Ostendo\Reports\Demo folder called ADMIN 2) Move a copy of the fr3 file into the Ostendo\Reports\Demo\Admin ...
    • Your user name and password are not defined

      If you get message 'Your user name and password are not defined. Ask your database administrator to set up a Firebird login' It appears that screen 'Alternate Database User' has been amended. You should note that this screen has nothing to do with ...