I have a field which should have only 20 characters and should not contain special symbols and words.
for eg. The field should not have * or # and should not have words like “admin” or “Adm” and the name entered should have only 20 charcters.
If unwanter symbol or words are entered it should not be writable and a message should display for few seconds that “Character/Symbol not allowed”.
Is it possible even partially in sailpoint iiq form? How can I do this?
This can be achieved by adding the validation script to the field. please refer the sample validation script. Yo can add the logic based on your requirement.
<Field displayName="Name" name="Name" postBack="true" required="true" type="string">
<ValidationScript>
<Source>
import java.util.ArrayList;
import sailpoint.tools.Message;
List messages = new ArrayList();
Message msg = new Message();
if(null != value){
if(value.length() > 20)
{
msg.setKey("Entered value has more than 20 character. Please enter the value less tha 20 characters");
messages.add(msg);
}
}
}
return messages;
</Source>
</ValidationScript>
</Field>
I have added some special characters , you can add more as well what you want to exclude and also words I added, adm, admin, you can add more using | symbol
<Field displayName="Restricted Field" displayType="textarea" dynamic="true" name="restField" required="true" type="string">
<ValidationScript>
<Source>
import java.util.regex.Pattern;
import java.util.regex.Matcher;
String regex = "(?i)admin|adm|[@#\\$%&*_=+]";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(value);
if(matcher.find()){
return "Input String contains Non-Allowed Special Characters or SubStrings";
}
if(value.length()>20)
{
return "Length of Input should not be greater than 20";
}
else
return null;
</Source>
</ValidationScript>
</Field>