Automatic processing of User Self-Registration based on email address provided

Wayne Richmond
Tera Guru

Hi there. I am looking for a way to allow users to create their own accounts to access Service Now. The User Self-Registration plugin seems to fit the bill and I'd like to enable the automatic processing of requests, however I'd really like to build some logic into this, specifically, only create an account when the user provides an email address from a predefined list of domains, e.g. @mycompany.com or @mybusiness.com. Additionally, they can only log in when they have clicked a link in an email sent to that address (I'm sure we've all used websites where the latter is standard practice).I know the latter feature sort of already exists within Service Now with the 'Creating Users from Incoming Email'. Any thoughts?

 

Desired process/logic:

User visits login page and clicks Create Account

User provides details such as First Name, Last Name, Email Address

Check: Does email domain appear in predefined list?

No - Display error message

Yes:

Account is created but is inactive pending approval

Email is sent to email address provided containing approval link

Linked is clicked and account is made active

Email is sent to same email with a temporary password

User logs in and is forced to change password

1 ACCEPTED SOLUTION

I've managed to do this charlieward



Add this to the Validation registration Business Rule:



if (current.email.indexOf("domain") <= 0) {


  gs.addErrorMessage("You must be using a recognised Company email address");


              current.setAbortAction(true);


              return;


}



This is just one domain but you could add several OR statements in to add more domains.


View solution in original post

5 REPLIES 5

Actually, adding multiple domains wasn't as simple as I thought but the community has provided the solution:



Re: indexOf question



The resulting script is:



var eml = current.email;
var isValidDomain = (eml.indexOf('domain1') >= 0 || eml.indexOf('domain2') >= 0);



if (!isValidDomain) {


gs.addErrorMessage("You must be using a recognised company email address");

              current.setAbortAction(true);


              return;


}