Enforce first character to be an Uppercase letter on Password Policy

Sean8
Tera Expert

We are trying to set up a custom password policy. We can use the OOB fields on the password policy for most of our use cases except for enforcing the password to start with an alphabetical character.

 

Is there a way for us to do this?

1 ACCEPTED SOLUTION

Mio Matsushita
Mega Sage

Hello
You can use regular expressions in Password Rule Scripts for password policies.
If you want to capitalize the first letter, try setting it as shown in the image.

 

//ADD RULES LIKE THIS 'var rule1 = {'hint': gs.getMessage('Minimum 8 characters'),'regex':'^.{8,}$'};'
//AND PUSH THEM IN THE RULES ARRAY FOR ADDING NEW RULES.

(function executePasswordRuleScript() {
    var rules = new Array();
    var rule1 = {'hint': gs.getMessage('The first character is an uppercase letter'),'regex':'^[A-Z].*$'};
    rules.push(rule1);
    return rules;

})();

image.png

 

View solution in original post

2 REPLIES 2

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Sean8,

 

Here it is : 

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0726960


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Mio Matsushita
Mega Sage

Hello
You can use regular expressions in Password Rule Scripts for password policies.
If you want to capitalize the first letter, try setting it as shown in the image.

 

//ADD RULES LIKE THIS 'var rule1 = {'hint': gs.getMessage('Minimum 8 characters'),'regex':'^.{8,}$'};'
//AND PUSH THEM IN THE RULES ARRAY FOR ADDING NEW RULES.

(function executePasswordRuleScript() {
    var rules = new Array();
    var rule1 = {'hint': gs.getMessage('The first character is an uppercase letter'),'regex':'^[A-Z].*$'};
    rules.push(rule1);
    return rules;

})();

image.png