cardinal

Customization

Change an app's RecTypes for one site without touching the app's code.

A System Manager can change any app RecType for one site. The changes sit on top of the app's YAML, so an app update keeps them. Each change bumps the site's metadata version, and every node picks it up on its next request.

ToolWhat it changesStored as
Customize FormLabels, defaults, hidden, mandatory and other field properties, plus new fieldsProperty Setter and Custom Field rows
Custom FieldOne added fieldCustom Field
Property SetterOne property of a field or of the RecTypeProperty Setter
Client ScriptJavaScript that runs on the RecType's desk formClient Script
Permission ManagerRole rulesCustom RecPerm rows. See Permissions

Add a field with Customize Form

Open /desk/customize-form and pick the RecType, for example Customer.

Switch to the Form view to drag fields on a canvas, or stay in the Table view. Add a row with Label Region, Type Select and Options North, South, East, West on separate lines.

Save. Cardinal adds a custom_region column to the table and the field appears on every Customer form.

A custom field's fieldname is custom_ plus the label in snake case unless you set one. App fields keep their order and cannot be removed. Custom fields can go anywhere between them.

Property Setters

A Property Setter changes one property. Leave Field empty to change a property of the RecType itself.

FieldExample
RecTypeCustomer
Fieldcustomer_group
Propertyreqd
Valuetrue

A value of null puts back the app's default.

Client Scripts

A Client Script runs in the desk for each Record its RecType's form opens. It never runs on the server.

frm.on('refresh', (frm) => {
  if (frm.isNew) return
  frm.setIndicator('Reviewed', 'success')
  frm.addButton('Copy Name to Title', () => frm.setValue('title', frm.doc.name))
})

// An event named after a field runs when that field changes.
frm.on('status', (frm) => {
  if (frm.doc.status === 'Closed') frm.setValue('closed_on', new Date().toISOString().slice(0, 10))
})

The Insert Example button on an empty Client Script adds this script. Only a System Manager can write Client Scripts.

RecTypes made in the desk

A System Manager can also create a new RecType at /desk/rectype/new. Its table is named ct_<name>, and it belongs to this site only. App RecTypes use rt_ tables.

What cannot change

Migrations never drop a column. Removing a field leaves its data in place. cardinal schema orphans -t HOST lists columns that no RecType uses anymore.

On this page