Scripting enables you to many advanced scenarios. During the edit, before the form is open, you can change the record and form behaviors. In this case you use Scripting in the Table menu:

Scripting in the table definition menu

Actions/script triggers

  • On model load - runs once, when the form for Add/Edit is open
  • On model change - runs every type the form changes. And once when the form is opened.
  • Before model save - before the record is saved.
  • After model save - after the record is saved.

doo.model contains all of the table fields and some other predefined properties:

  • isValid - when you set the whole model as invalid, it is not possible to save the form
  • isReadOnly - makes the whole form read only
  • infoText - assign a message to this property in case you want to show something in the form header
  • hideCategory('categoryName') - it hides the whole category (tab) on the form
  • showCategory('categoryName') - and this shows it again

The properties have format <[Header] (internalName)]> In case you change the header, the script works without any change. In case you change the internal property of the field, you need to project this into the script.

Every field of the record has these properties/methods:

  • value - the current property value
  • setValue(value) - make it easier to assign a value to linked fields, dates ...
  • originalValue - the value in the moment the edit started
  • currentlyChanged - if the value has been changed since the last run
  • isVisible - if the input is visible
  • isRequired - if the input is required
  • isEnabled - if the input is enabled
  • filterForDropdown - it is used to filter dropdowns, lookups
  • label - for changing label/header of the table definition


In case, you are not sure, how the model object looks like or what the value of a variable is, check the value in the developer console of the browser


Or you can debug your javascript step by step and check values of variables and so on in the developer console of the browser using debugger command in your code (be sure to delete it when done :))


You can open the developer console by pressing F12 in Chrome/Edge browser or CTRL+SHIFT+I in Opera browser and similarly in other browsers.


The field "Url" should not be enabled in case the type is not "Digital":

doo.model.<[Url (asewx)]>.isEnabled = 
    doo.model.<[Type (keyc5)]>.value === 'Digital';

The field "Url" should not be visible in case the type is not "Digital":

doo.model.<[Url (asewx)]>.isVisible =
    doo.model.<[Type (keyc5)]>.value === 'Digital';

Prefill the State field according to user branch (We added the field branch to Users table).

doo.model.<[State (stawer)]>.value = 
    doo.currentUser.branch === '550' ? 'New' : 'Active';

The form is not valid in case ...

doo.model.isValid = doo.model.<[Url (url)]>.value.indexOf('http://') === -1;

Filter values for roles. The filtered field State is a Dropdown type

// Admin role can choose from two states, others only one
if (doo.currentUser.roles.indexOf('Admin (system)') != -1) {
  doo.model.<[State (state)]>.filterForDropdown = ['Active', 'Closed']
} else {
  doo.model.<[State (state)]>.filterForDropdown = ['New']

Filter linked lookup (this filter enables only few simple conditions!)

doo.model.<[Members (x21sf9ws40)]>.filterForDropdown = "Branch === B01"

doo.model.<[Members (x21sf9ws40)]>.filterForDropdown = 
    "Branch === A01 or Branch === B01"

doo.model.<[Members (x21sf9ws40)]>.filterForDropdown = "Branch contains B01"