How do I setup/register a new app user automatically?
How can I do something automatically the first time a user uses the app?
This example assumes your app requires sign-in, and that you have a table named Users, each row of which describes a single user of your app. Such a table is a common way to store information about your app users and as an alternative to User Settings to store their individual app settings. The Users table is assumed to have a column named Email to store the email address each user uses to sign-in.
The process presented here does not replace the need for signed-in users to be registered as app users in the app editor.
If your app does not require sign-in, the best you can do is automatically detect a new device, which may or may not correspond to an individual user. Without user sign-in, you might have a Devices table instead of a Users table, and should use CONTEXT("Device") rather than USEREMAIL().
Try this:
Create a table or slice with exactly one row to serve as a menu for the new user.
Create a Data: add a row to another table using values from this row action for the table (1) that adds a new row to your user table for the current user if the user is not currently in the user table, with an Only if this condition is true expression like: NOT(IN(USEREMAIL(), Users[Email]))
Create an App: go to another view in this app action for the table (1) with a Target expression that uses a LINKTOā¦() function to navigate to a desirable starting view after the user addition.
Create a Grouped: execute a sequence of actions action for the table that performs both actions (2) & (3).
Create a deck, gallery, or table view atop the table or slice (1) for the new user start view.
Set the Row Selected event action for the new user start view (5) to the Grouped action (4).
Set the Starting view in UX >> Options to an expression that directs the user to the new user start view (5) if the current user is not currently in the user table, like:
replacing new-user-start-view with the name of the new user start view (5), and existing-user-start-view with the name of a view existing users should see first.
Use Show if in all other views to hide them if the current user is not registered, to prevent the unregistered user from bypassing registration.
The two views where āApp Users_Formā is of type Form with source set to App Users table, and āHomeā doesnāt matter.
Iāve run this in āTestā mode and it returns the correct view name i.e. āApp Users_Formā but app still goes to the middle tab by default.
Why must you memorise a list of steps on how a achieve such a simple thing (itās an if condition people!?) Why canāt a new user just figure it out themselves?
Just yesterday I had a client report to me that one of their users has 511 pending syncs on their device.
At some point last Friday, the user encountered an error; and instead of reporting it and trying to figure out whatās wrong, they kept working - racking up pending-sync after pending-sync, and only a week later (when the boss is wondering where all the data is) does the user say something.
elco:
Why canāt a new user just figure it out themselves?
Okay now Iām more sad than mad. I donāt know why this doesnāt work.
Iāve tried in Incognito window where I had to login and I was lead to central tab (which is not the else choice in if condition). Does it perhaps cache which view user was on their last visit? Is there any other way to debug this further?
I know my email is not in the App Users[Email] table column and like I said in test tab it shows correct result, but not on deployed version.
MultiTech_Visions:
What @Steve did with this post is provide you with a complete list of steps needed to achieve the result.
I see. I donāt understand but I see. I donāt need to now that you say my method should work
Thanks! That finally works (Sidenote: I didnāt know it takes a while for the deployed app to sync to latest version, it didnāt work for first few minutes and I almost reverted it back.)
But why? I donāt understand what the difference is between those two version? IN documentation says it returns FALSE when element is not present.
Edit: Okay maybe early celebration, itās quite erratic.
It works in IDE i.e. in the preview window but itās stopped working on deployed version in browser even in incognito mode. On mobile doesnāt work either (how do you refresh the app sync doesnāt work?). I also would have thought that a manual sync would take you to āStarting Viewā (but guess it makes sense sometimes not to either) so it never works when I do that.
Does anyone know exactly when this statement is evaluated i.e. āStarting viewā? Everytime you open the app in a new tab or when you login? Any docs on this topic?
Thanks for the help but donāt wanna take over the thread; Iāll try contacting support this is crazy behavior!
There is certainly some sort of caching going on in the browser; even when I open link in new tab. When I go to any view and goto the app link w/o the #appName=Ello-2907772&group=%5B%5D&... and it still goes to the last view open. This makes me thing it doesnāt evaluate the starting view condition otherview itād either goto Home.
āThe first timeā means the very first time the user opens the app, not whenever the user opens the app anew. The behavior of starting view has been changed since this community topic was created.
Performing a hard reload of the app editor (Shift+Ctrl+R) will cause the app emulator to behave as if starting your app the very first time. I thinkSave & Verify Data will, too.
So thereās no way to force users to sign up when they first arrive to the app? They can āCancelā the form and can continue to next view. This will also fail many filters/slices/formulae because they expect there to be a row with userās email in the Users table.
You could add a dummy row thatās used when the current app user isnāt recognized. Send unrecognized users to that row, require them to do something with it, and withhold all other functionality until the current user is recognized.