Portal Rules#

Portal Rules are used to define conditional behaviour for Portals, especially for showing and hiding elements. Rules are rooted in M-Files’ filter conditions (in our case, Property-Based conditions), the idea is that one or more conditions can be assigned a ‘Name’ which we can use in portal components.

E.g., most components have a text field called ‘Show when’ indicating when that component should be displayed to the users. The default value for this field is true, meaning that it is always being shown. We can change this to false to ensure that the component is never shown. This is not very useful by itself, but, if we define a portal rule called has_project_manager and set its filter conditions to be something like 'Project manager' is not empty, we can set a component to only show if a project manager is assigned to the Portal subject object, by setting the ShowWhen-field to has_project_manager.

In addition, multiple PortalRules can be combined using Boolean statements. The available operations are and, or, not and equals. Precedence can be controlled by parentheses (( & )).

Example#

Let’s say we add three more PortalRules:

  • created_by_me - Whether the Portal subject object was (originally) created by the current user.

  • deleted_by_me - Whether the portal subject object was deleted by the current user.

Then, it’s possible for us to e.g. add a segment that we only display if a portal was deleted by our current and originally created by our current user by adding the following to the segment’s ShowWhen-field: deleted_by_me and created_by_me.

../../../../_images/2023-04-11-14-07-38.png

Our resulting portal#

../../../../_images/2023-04-11-14-21-50.png

Our portal component configuration#