Skip to main content
v3 - Developer
Updated over 7 months ago

Index

  • Reports

  • Dashboards

  • Models

  • Handlers

  • Resources

Extensions

Extensions are a tool to alter the normal operation of the program, such as:

  • add custom fields to a program screen

  • make fields read-only

  • hide fields from a screen

Code to add a custom field in a table

<extension type="model" target="customer"> <field name="allergies" type="string" nullable="1" label="Allergies" /> </extension>
  • target the table name

  • name the name in the database that will be in lower case and without spaces

  • type:

    • string for a short text.

    • text for a long text.

    • bool for a checkbox type field.

  • nullable if you want this field to be left empty

  • label the name of the label and what will be displayed on the screen

Code to add a custom field on a screen

<extension type="view" target="customer/:id"> <extend path=".//Fieldset" position="add"> <field name="allergies" /> </extend> </extension>
  • target the table name

  • name name of the field in the previous step

Code to add a custom field in a listing

<extension type="view" target="customer"> <extend path=".//fields"> <field name="allergies" hidden="1" /> </extend> </extension>
  • target the table name

  • name name of the field in the previous step

  • hidden if we want it to not appear in the list by default

Code to hide a field

<extension type="model" target="customer"> <field name="email" perm="customerAdmin" /> </extension>
  • target the table name

  • name name of the field in that table

  • perm in this case would be perm=“customerAdmin”

This means that to see the email field of a customer's file, you must have the “customer administrator” permission activated.

Code to make a field read-only

<extension type="model" target="customer"> <field name="email" writePerm="customerAdmin" /> </extension>
  • target the table name

  • name name of the field in that table

  • perm for this case would be writePerm=“customerAdmin”

This means that to see the email field in read-only mode (without being able to edit it) of a customer's file, you must have the “customer administrator” permission activated.

Did this answer your question?