Skip to main content

Create new visibility rule

  1. Imagine workspace manager wants to see the form with information about when timelog was created.
  2. For this - let's add creation-date field to the layout, edit views/layouts/dashboard.xml .
<field name="creation_date" />
  1. Publish the app and see this info shows in the form now:
Creation date field
  1. This field is now visible for everyone, but let's show it only for workspace admin, who really wanted this
  2. In VS Code - let's edit views/ui-code/index.ts file - add line #4:
visibilityFunction() {
const invisibleFields: string[] = [];
if (entity.state !== 'rejected') invisibleFields.push('state');
if (!entity.c_cost) invisibleFields.push('creation_date');
return invisibleFields;
}
  1. When you publish the app - this field will be visible in the form only for the workspace admins