I have been working on setting up custom user flow. For the sign up piece, we follow a bit different process as an organisation. Users don't get access to our product just by signing up. They need to fill out a form which is shared over email once they express interest. After filling out the form and if their application is approved, that is when they can start using our product. How do I go about the email piece for it as using post/user_invite triggers an invitation email
@antonybello could you please split this off into a new topic so we're not hijacking this one?
@Vinyasa_Health
I'd suggest making a table in your retool db for 'registration' or something. you'll want columns for at least something like:
user_id (Int - PK, NOT NULLABLE, UNIQUE)
status (String - NOT NULLABLE, NO DEFAULT)
form (JSONB - NULLABLE, DEFAULT 'null')
enabled (Bool - NOT NULLABLE, DEFAULT 'true')
- user_id will be current_user.id
- status we'll use as a state machine. it's value decides where in the registration process a user is.
- form will hold a copy of the form they filled out. this could also be a url or the table row id
- enabled is so you can prevent access even after registering and being approved (maybe their sub runs out or you have to ban them or something)
now create a new Form
While editing the form, in the top-right corner click Publish
and copy the link. It'll look something like:
https://<your_org>.retool.com/form/17a4eb5d-7cb6-4701-b5f9-44c4d7b9bf6c
you can include this link in the email you send to the user which they'll fill out and submit.
here's an example of one I send marketing spam to (so i can track it... but with the intention of never contacting them)
you can use workflows to build events that occur after the user submits the form like updating a table in your retool db to set the status
column for a user.
General Steps:
- User expresses interest
1a. Add user toregistration
table and setstatus
toinitial_contact
(or something to denote the beginning of the process),enabled
totrue
,form
tonull
anduser_id
tocurrent_user.id
- After user expresses interest, use workflow to Email user with url of Form
2a. Set userstatus
toawait_navigation
- User clicks url and loads the form
3a. Set userstatus
toawait_submission
- User submits form
4a. Set userstatus
toawait_approval
5a. Save the form for review in theform
column - After user submits form use workflow to Notify you of the new form submission that needs to be approved
- If you approve, set
status
toapproved
otherwise set torejected
.
On the Frontend you can now run a query on page load. you just lookup current_user.id in the registration
table and respond to the possible results:
- if the id was not found, the user has not expressed interest yet - consider asking if they would like to with yes/no buttons
- if the id was found and
status === 'rejected'
ORenabled === false
don't show content - inform user application was rejected or they were banned - if
enabled === true
- if
status === 'approved'
display content - if
status === 'await_navigation'
user has not clicked link in email yet - if
status === 'await_submission'
user has clicked the link and possibly filled out the form (partially or in full) but has not clicked submit yet - if
status === 'await_approval'
user has filled out form, clicked submit and is now waiting for approval
- if
Note: consider moving this to the Query Library so that any app/module can use it. you could extend this and require separate forms for different pages or apps by:
sett status
to JSONB
[ { 'feature': 'client_page', 'status': 'approved', 'form_id': '17a4eb5d-7cb6-4701-b5f9-44c4d7b9bf6c' }, { 'feature': 'marketing_apps', 'status': 'approved', 'form_id': 'random_uuid_here' } ]
we've combined the form
column with status
so delete form
as it's duplicate data now. this let us denote which form was filled out and approved (maybe somebody has access to something they shouldn't, you can check if they filled out the wrong form thinking it was something else resulting in getting access to the wrong thing).... since we know their id with current_user.id
we can navigate to the form data and use this id to get the values they submitted or we can check our db using the same id.