I have created a button where a user can click, enter the email of a person and the workflow generates a random 6 letter string and sends it inside an email to above mentioned id. This random string is stored inside the current user’s User data type as Refer Code field.
I am stuck in how to detect if a user is signing up using the refer code and whether that code is valid or not and who referred the person. How do I go about that?
I believe that your setting may be complex when it should be simple.
When user enter the email, store the email into a list of text field in current user.
When a new user signup, check to find the email into the list of text field. You will get the user who referred the person.
If you want to keep the ID, you can use the same pattern and search id instead of email
Makes sense. But how do I search the email id when the user is signing up? And should it be done after the whole sign up process has been completed or before. Because I think it would be better if there is an error message that is displayed if the ID is wrong and for that the check needs to happen before sign up.
You can search before or after.
Basically, if you Do a search for User, filter: id contain id:first item this will return the user who have referred. If empty, this mean that the code may be wrong.
I guess you will use url parameter in the email to know the ID. So you need to get it from url.
Another solution can be to create a new “Thing” in DB. When user create a referal, you create a new thing in this DB. And you use the created Thing as url and create a page with the data type to this new thing.
@Jici So I have managed to take a step forward but it is still not perfect.
Basically, if you Do a search for User, filter: id contain id:first item this will return the user who have referred. If empty, this mean that the code may be wrong
This is the workflow that I use to generate a Refer code and send it via email.
I could not understand how to do the search for the code/email in the sign up flow. This is what I have done. This workflow is able to check if the field is empty or not but it doesn’t check the validity. What am I doing wrong here ?