After the recent roadmap webinar (embedded below) a few customers asked how they can create a personalised list within their app. This post will explain how.
- create a registration screen called ‘Registration’ with a registration form, include an ‘email’ field and any other fields you want
- ensure the form saves to a ‘users’ data source
- create a sign in screen called ‘Login’ and add the login component. Link the login component to the ‘users’ data source
- create a new screen called ‘Manage task’ and add a ‘task creation’ form. Add the following fields:
- task name
- email make sure this field is hidden, set the default value type to ‘user profile data’ and set the default key to ‘email’ This will ensure the logged in user’s email address is always saved into the data source so we can ignore tasks from other users.
- Ensure the task creation form saves to a ‘tasks’ data source
- create a new screen called ‘My tasks’ and add a List from data source component. Link it to the ‘tasks’ data source and setup the data view settings to display the relevant task information in the list
- Under ‘How do you want to filter your list’ filter the email field so that it equals the value type ‘user profile data’ and set the value for to ‘email’. This will ensure the list is automatically filtered by the logged in user’s email address
- Switch to preview mode then
- register and login to your app
- create a task, you should not see the ‘email’ field as it’s hidden
- view ‘My tasks’, you should be able to see the task you created
- click ‘Reset preview’ on the right of the preview window in Studio to clear your logged in data
- register with a new email address, login, create a new task and ensure you can only see tasks created by this user. If you cannot see the tasks for other users your form and list from data source are working correctly and only showing the current user their tasks! Congratulations!
Additional steps you should do before sharing your app with other users:
- Setup app security rules to ensure only logged in users can access the my tasks and manage task screen
- Setup data source security rules to ensure data is limited to specific users. Ensure the email field is required to ensure the app must provide an email in order to query the data source