- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 07:38 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 08:15 AM - edited 02-16-2024 08:16 AM
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;
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 08:07 AM
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....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 08:15 AM - edited 02-16-2024 08:16 AM
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;
})();