Capturing user email domain

Hello! Any ideas on how to capture the email domain on sign up and then associate it with a value in another field (in this case a company)?

The purpose of this would be to group users with their companies based upon email domain so they can be assigned the appropriate workspace. Example: tony@kitchens.com signs up.

  1. Capture @kitchens.com as the company domain and then:
    2a. If a @kitchens email has never signed up before, ask the user to assign a company name value that will then be associated with all @kitchens emails going forwards.
    2b. If an @kitchens.com email has signed up before, assign the same company value associated with that user.

Any help much appreciated.

I’m not sure, but I’d do this one of two other ways if I were building this.

1st way - Have a company code that every user enters on signup and use that code to link the user to the appropriate company.

2nd way - In stead of individual users signing up have an admin user for the company add users that way they are automatically linked to the same company.

Not sure if either of these ways would work for you, but there are options :smiley:

There are 2 was I can think of, either use the Arbitrary Javascript component, which as you are new you probably do not have, or use a backend service like Xano and a custom action.

Here is a video showing both methods. Neither option is simple or straight forward, even though what you are asking sounds like a simple thing to do.

2 Likes

Thanks @Bobby I have tried out the company code and it is certainly good to have as a back up but hoping I can implement something a little cleaner using Xano or the Arbitrary Javascript component.

I will be building this functionality too :slight_smile:

@TKOTC Thanks for such a complete response! Really appreciate it.

Thanks again!

(post deleted by author)

@TKOTC Hi Steven,

Thanks again for the help. Does the Xano methodology you used require any JSON? I am referring to the field that is just out of shot at about 34 seconds.

No JSON being sent to the server, just the query parameter. JSON being returned from Xano so Adalo knows how to work with it.

So you send a link like
Xano.com/blahblah?steven@pragmaflow.com

And Xano returns JSON
{
“result”: “pragmaflow.com
}

If you follow the video, you can change the return to what you please. This way Adalo can parse the JSON return and result becomes a magic text field.

2 Likes

Thanks again @TKOTC - that makes sense. Is there any reason you can think of that would mean the result of the custom action result does not always appear as a magic text option?

You’re welcome.

The reason your result is not returning is a simple error to fix @1:00 into your video where you show the request. The issue is that you do not have a default value set in the Email field on the right hand side. @1:04 the url becomes ?to_parse=undefined rather than a proper email. If you enter in a default value at the 1 minute mark it will have the Magic text return so you can use it.

For a little more information into the problem (this is for completeness, not that you need to read on). The test successful comes from a positive 200 response from Xano, ie the domain associated with undefined is blank. So Xano has told Adalo the email portion of the test value is blank, in RESTful terms
Status 200, body: {}

If you enter in the email in the default field you will get
status 200, body: { “result”:“domain.com” }
then Adalo will auto-magically detect “result” and use that for Magic text.

If you rerun the test again without a proper email your magic text will disappear again.

In summary, when you are testing the URL, ensure that the to_parse is indeed a proper email address and you will not run into issues in the future.

2 Likes

Unreal! Thanks again @TKOTC . The additional context is also very much appreciated and really helps with the learning curve!

Again, you’re very welcome. If you get stuck on other issues, or if this issue rears its ugly head again feel free to start a new thread or post back here.

1 Like

Thanks Steven - really appreciate it. Have a great weekend!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.