Help with checking if customer exists in db

We need to change the way our website handles a customer that says they are new but the email address already exists in the database.    Our consultants  say they need a custom stored procedure from us and It seems like such a simple thing but I've never written anything for the Web so i'm not sure.    I don't fully understand why they don't just use the same process that is used when logging into the website but apparently they don't.  Please read below, it's an excerpt from my support ticket with Gregg Stickney who summed it up so well.  Hope this makes sense - in other words, I'd like a little help with the procedure if possible.

There is not a built-in method in the API which will determine if a login already exists other than to attempt to Register the login and see if it returns an error that it already exists.  I notice that if I go to your websitee and click the Login link from the homepage that I get a screen which allows me to enter my email address and select whether or not I am a new customer.  If I select that option, the next screen asks only for my first name, last name and password (completing the minimum number of parameters for registering the login).  At this point if I were to proceed to the next step, I'll bet I would get an error if the login already existed.  So, without entering all that personal info, I would know if my login was already in use. 
 
In your purchase path, the process is different.  I get the same initial screen, but if I say I am a new customer I go straight to the big form that asks me to fill in all of my details.  Behind the scenes, this form is probably calling Register to create the login and shell customer account and UpdateAccountInfo to update the account with all the personal data.  Trouble is, the customer has already filled in all the personal information before the form is submitted, Register gets called and determines whether or not the login exists.
 
So, I would say your options are to separate the Register portion of the process from the UpdateaccountInfo stuff like you do in your main Login link so that if the login is already in use the customer would know before filling out all their personal information, or create a local procedure as suggested that can look up the supplied email address to see if it is in use in an active login before moving to the next step.  My recommendation with the latter would be to simply return a flag (like Y or N) from the procedure to indicate if the login exists and not return any account data for data protection purposes.
 


Parents Reply
  • Just to elaborate a bit... 

    This procedure is called when someone wants to create a new account. If this procedure finds the account, we first ask the customer to verify the name only (no personal data), and if they click OK, we create an account in our ecommerce system and email them a password, which they have to use to log in. This way there is some protection of the private information on the customer's Tessitura account.

    David

Children
No Data