How to create a menu that point to dynamic form ?

Hello,

I'm trying to build a custom multilingual system. I have a table (Settings) where I save the user preferred language config. I need to :

  • If the user Email is not found in Settings, open the form in create mode
  • If the user Email is already Settings, open the form in edit mode using Email as Key
  • The form should be accessible as primary menu

How can i do it ? If it's not directly possible, how can i get a similar effect ?

Solved Solved
1 6 157
1 ACCEPTED SOLUTION

Please try below

1) Hide the system generated "Add" action on the table "Settings"

2) Create a slice called say "Current_User" on the Settings table with a filter expression something like 

    [Email]=USEREMAIL()

where [Email] is the column that stores users' emails in the table. Users table should have one record per user.

Please read the epic tip Current User (Slice) | How to conform your app a... - Google Cloud Community by @MultiTech 

if you would not like the settings of one user to reach the deice of another user, you need to use security filters instead of slices. Please read the section "Security filters versus table slices" in the help article Scale using security filters - AppSheet Help

3) Make a copy of the system generated form view on the table Settings. The system generated form view of the table will have a name something like "Settings-Form". Name the copied form something like  "New User Form" and position it in the primary position. In the show_if of this copied view, please have an expression something like 

ISBLANK(Current_user[Email])

4) Make another copy of the system generated form view on the table Settings. The system generated form view of the table will have a name something like "Settings-Form". Name this second copied form something like  "Existing User Form" and position it in the primary position. In the show_if of this copied view, please have an expression something like 

ISNOTBLANK(Current_user[Email])

Well that is it.

View solution in original post

6 REPLIES 6

Please try below

1) Hide the system generated "Add" action on the table "Settings"

2) Create a slice called say "Current_User" on the Settings table with a filter expression something like 

    [Email]=USEREMAIL()

where [Email] is the column that stores users' emails in the table. Users table should have one record per user.

Please read the epic tip Current User (Slice) | How to conform your app a... - Google Cloud Community by @MultiTech 

if you would not like the settings of one user to reach the deice of another user, you need to use security filters instead of slices. Please read the section "Security filters versus table slices" in the help article Scale using security filters - AppSheet Help

3) Make a copy of the system generated form view on the table Settings. The system generated form view of the table will have a name something like "Settings-Form". Name the copied form something like  "New User Form" and position it in the primary position. In the show_if of this copied view, please have an expression something like 

ISBLANK(Current_user[Email])

4) Make another copy of the system generated form view on the table Settings. The system generated form view of the table will have a name something like "Settings-Form". Name this second copied form something like  "Existing User Form" and position it in the primary position. In the show_if of this copied view, please have an expression something like 

ISNOTBLANK(Current_user[Email])

Well that is it.

Suvrutt dropping that knowledge! 🧠💪

Thank you for your answer.

You say "Hide the system generated "Add" action on the table "Settings"", how can i do it ? By deleting the action Add ? But i need it for other operations 
I've done the other steps, it's still open in Add mode. How am i supposed to tell to the system which Settings Form is supposed to be used ?

You can hide an action simply by selecting the hide setting in the action settings pane.

Suvrutt_Gurjar_0-1742398529709.png


@AP37 wrote:

But i need it for other operations 


Could you update exactly for what "other" operations you need it?

You have requirement of adding a "new" form and editing and "existing form" that the solutions mentions. So typically you should not need the normal "Add" button for the settings table.

 

Thank you for "Hide" button, i've missed it.

About the operations. I need to :

  • For current user, to be able to update his Settings
  • For admin, to be able to add new user settings and manage all Settings.

I'm trying to handle it with Only if this condition is true in Add action

Even after hide, the menu open the in Add mode. How to switch to my Custom Settings_Form ?

Edit : To clarify
I have added the 2 new Settings Form in the menu. But, except the names and show if, there is no difference. So, when i click on, i don't get the Update but still Add.

Edit 2 : Row key is needed for Edit form. It's working when I set USEREMAIL() as Row key. 

Thank you everyone

Thank you for the update.  Nice to know you made a progress.

Here are my responses


@AP37 wrote:

About the operations. I need to :

  • For current user, to be able to update his Settings
  • For admin, to be able to add new user settings and manage all Settings.

For the current user, she /he can use the ""Existing User Form" 

For the admin, you could have a condition in the "Add" action something like 

USEREMAIL()= "admin@email.com"

where "admin@email.com" is admin's email ID. That will ensure the add action can be seen only by the admin.


@AP37 wrote:

Edit 2 : Row key is needed for Edit form. It's working when I set USEREMAIL() as Row key. 


 

Yes, that is correct. This is a very good point that I inadvertently missed mentioning in my detailed solution description. In my testing, of course I had configured it as the following screenshot shows.  For such a tricky solution, I tested it before suggesting and missed that point while listing several steps. Anyway, excellent thinking on your part. 

 

Suvrutt_Gurjar_1-1742443558248.png

Best wishes on your app creation.

 

 

Top Labels in this Space