Rule that capital letter be used in creating identity form

All,
I have a form that I am using when we need to create an identity in SailPoint. The first 2 attributes to fill out on the form are “First Name” and “Last Name”. But, too often the requestor never Capitalizes the first letter in those 2 attributes. If there a rule or some sort of edit change that I can do so when a requestor inputs the name, he has to use a capital letter at the beginning for the first and last name inputs.

A piece of the form is shown below:

<Field displayName="Comments:" name="displayComments" type="string">
  <Attributes>
    <Map>
      <entry key="readOnly" value="true"/>
    </Map>
  </Attributes>
  <Script>
    <Source>return identityModel.get("comments");</Source>
  </Script>
</Field>

What you want is a ValidationScript. See Fields

Or if you have a beanshell rule already for this kind of input validation you can call it with a ValidationRule element.

I haven’t tested this (should be fleshed out for null checking etc), but something like this should work:

<ValidationScript>
 <Source>
  if (!Character.isUpperCase(value.codePointAt(0))) {
   return "Name must start with upper case letter";
  } else {
   return null;
 }
 </Source>
</ValidationScript>

Do i put this validation script into the form?

An also exactly where in that form

Inside the field element.

<Field displayName="Comments:" name="displayComments" type="string">
  <Attributes>
    <Map>
      <entry key="readOnly" value="true"/>
    </Map>
  </Attributes>
  <Script>
    <Source>return identityModel.get("comments");</Source>
  </Script>
  <ValidationScript>
   <Source>
    if (!Character.isUpperCase(value.codePointAt(0))) {
     return "Name must start with upper case letter";
    } else {
     return null;
   }
   </Source>
  </ValidationScript>
</Field>
1 Like

And the null safe version of Marks example:

2 Likes

All,

I have attached an example of the form we use in our UAT environment. Where exactly do i put this validation script for first name and then last name?
UAT-Create_VDOT_User.xml (10.4 KB)

Hi @derrickthomasvdot ,

It should look something like this

  <Section label="Enter User Details" name="userDetails">
    <Field displayName="First Name" helpKey="First name of the user - NO SPACES" name="firstname" postBack="true" required="true" type="string">
      <ValidationScript>
       <Source>
        import sailpoint.tools.Util; 
        if (Util.isNotNullOrEmpty(value)) { 
          if (!Character.isUpperCase(value.codePointAt(0))) {
             return "First Name must start with upper case letter";
          } 
        }
        return null;
       </Source>
      </ValidationScript>
    </Field>
    <Field displayName="Middle Name" name="middleName" type="string"/>
    <Field displayName="Last Name" helpKey="Last name of the user - NO SPACES" name="lastname" postBack="true" required="true" type="string">
      <ValidationScript>
       <Source>
        import sailpoint.tools.Util; 
        if (Util.isNotNullOrEmpty(value)) { 
          if (!Character.isUpperCase(value.codePointAt(0))) {
             return "Last Name must start with upper case letter";
          } 
        }
        return null;
       </Source>
      </ValidationScript>
    </Field>

UAT-Create_VDOT_User.xml (11.1 KB)

All,

I tried the to input the following as suggested but received the following error per the screenshot:

What could i be doing wrong?

Hi @derrickthomasvdot

As showed in the earlier , the closing tag for firstname is below and this shouldn’t be closed at this line


It should be like below

<Field displayName="First Name" helpKey="First name of the user - NO SPACES" name="firstname" postBack="true" required="true" type="string">

Make sure to follow the same thing for LastName as well, if you are using the validation script for Last Name

I have removed the needed but continue to receive the error: attached

Hi @derrickthomasvdot

You haven’t added the closing tag </Field> in first name and Last Name which was there on the earlier screenshot you shared.

That corrected the issue. Thank you!

1 Like

@derrickthomasvdot
Good to know that your issue is resolved. Please it as Solved and close the thread. It will help others looking for solutions.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.