Designing a User-Specific Menu

I’m attempting to create a menu where users will only see the pages assigned to their company.

So far, I’ve taken the following steps:

  1. In Option Sets, I’ve listed all my Main Pages and Sub Pages.
  2. On the Main Pages, I have an attribute where I add the Sub Pages that belong to the respective parent.

In Datatypes, I have a Company with fields for Main Pages Access and Sub Pages Access (both are lists tied to the aforementioned Option Sets). This is where I add the pages that each company should see in their menu.

In my menu, I have a repeating group for Main Pages pointing to the Main Pages assigned to the company (this is working).

Within this repeating group, there’s another repeating group that displays the subpages under the Main Pages. And here lies the challenge. The only option that passes through without triggering an error is “contain list.” However, the menu refuses to display the assigned subpages unless the company has access to ALL subpages assigned under a Main Page.

Start with a list of all pages (main and sub) filtered by company; store these in a custom state or group you can reference.

Pull from this pre-filtered list for your main rg and nested rg.

For your nested repeating group use this sub option is in: parent main’s option’s subpages and then intersect with the pre-filtered RG (last part to get the company specific options).

1 Like

Thanks Matt!

I made this custom state:

But how can I add filter to the CS?

Where you set the custom state (in an action). In that expression add the filter. Does that make sense?

1 Like

Oh, I see. I just added it on the root of the reusable element without an action. But on action page load? Is that ok? :slight_smile:


Does this look right?

I didn´t find a way to add the CS for sub in the last one?

Yeah looks fine although you’re just missing the intersect with on this guy:
image

And instead of setting CS on page load better would be when this reusable is visible - otherwise that workflow could be firing when not needed.

2 Likes

T hanks Matt! :slight_smile:

I will try that later today!

Thank you, MattN.
Made this work with the intersect that was missing, perfect!
Skjermbilde 2023-12-22 154246

Company specific menu has now been achieved. Now the next and final issue with the menu is to make it user-specific. Let me ellaborate (bear with me):

The users (who can belong to the same company, and as such on a company level have access to all or some menu-options) also have a Role. The roles are stored in an Option Set. (Manager, Standard, Guest etc.).
I am not sure if that is a logic that will work, hence we have also made Fields on a user level called ‘unique_mainpage_access’ & ‘unique_subpages_access’. These are a a list of Main pages and subpages.
It looks like this at the moment of writing:


I would think I could apply the same logic as with company, but I’m having issues breaking through. It seems it’s not triggering for me, and only the company access is taken into account.

Thanks again!!

This topic was automatically closed after 70 days. New replies are no longer allowed.