Execute a behaviour on opening a view?

I’m just wondering is there a way to execute a behaviour on opening a view? I thought it might exist in workflows but it doesn’t seem to.

A little background in case someone has a better suggestion, because this is hacky in itself:

This is my Home view. It has a bunch of options that all lead to different views in the app. However, it’s gotten a bit cluttered now and there are different employee roles, so I’ve made it show only the options relevant to whatever ‘Mode’ the user is on (this is just a text column in the Staff table). This works fine, but now I need a way for the user to change the mode, ideally with only one click.

So all of the items on the Home view lead to views, but what I want Factory and Transport (and one more that isn’t shown here) to do is change the value of Mode, and ‘refresh’ the Home view.

The most straightforward way I thought of for doing that is having a Factory view, for example, with nothing in it, and just having a behaviour execute when it is navigated to that 1. changes the user’s Mode to ‘Factory’ and 2. redirects to Home, where the correct options will now be displayed. However, I can’t find a way of executing a behaviour automatically like that.

Any ideas?


What you want to do is not trivial, but it is possible. You have to create an action to perform when the user clicks on one of the entries in your menu:

The action (which will likely itself make use of additional actions) will have to consider which entry the user chose and do the appropriate thing.

1 Like

Thanks - I’m actually already using that feature on that menu in conjunction with a ‘link to view’ behaviour (name of the view is stored in the sheet with the images and labels).

The problem with this method is that if I want to have some of the menu items redirect the user to another view (as they are currently) and some of the others doing the whole change value flow, I somehow need to incorporate a condition there. Would be really nice if there was an “if-then-else” behaviour!

I suppose I could use a Dashboard view, but it doesn’t really look like what I want.

Ummm… There is. :confused:

Really? I only see these:

(Unless I’m blind)

I suppose I can do something like execute an action on a set of rows and build the condition into that (ie select 0 rows)

Actually I wonder about the functionality of this:

Does this condition get applied if you call the behaviour directly from another behaviour (grouped action thing)? I always assumed it just stopped the icon from displaying for behaviours where the user could execute them with a button.

1 Like

If you create an action of type Grouped: execute a sequence of actions, you can populate it with actions that are performed conditionally according to their individual Only if this condition is true expressions. Note that all actions in that sequence with Only if this condition is true expressions that evaluate to TRUE will be performed.