0
function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
          return;
    }
  g_form.hideErrorBox('num');
       var pattern =/^([A-Z]{1}[a-z]{2,30})$/;   // regex pattern
   if(!pattern.test(newValue)){
     g_form.showErrorBox('num', getMessage('First letter start with capital and max length is 30 character'));//show error messege
           g_form.setValue('num', '');
   }
}
First letter with capital letter and max length is 30 Validation Regex Client Script ServiceNow
Working Code Asked question August 8, 2023