Create new visibility rule
- Imagine workspace manager wants to see the form with information about when timelog was created.
- For this - let's add creation-date field to the layout, edit views/layouts/dashboard.xml .
<field name="creation_date" />
- Publish the app and see this info shows in the form now:
- This field is now visible for everyone, but let's show it only for workspace admin, who really wanted this
- 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;
}
- When you publish the app - this field will be visible in the form only for the workspace admins