Hi Team,
We have a workflow to generate a dynamic form in that form we need to write a validation script so can you please let me know how can we achieve it
Hi Team,
We have a workflow to generate a dynamic form in that form we need to write a validation script so can you please let me know how can we achieve it
Are you looking to validate the entire form or are you looking to validate specific fields in the form?
For the individual fields, you can put a script in the validation section of the field. If it’s the entire form, you would probably be looking at an approval node in the workflow that returned valid or not from the script and either went back to the form or continued on.
We are looking for field validation only but it not allowed validation script tags
You should be able to do validation in a field like this:
<Section>
<Field displayName="The Field" helpKey="You can enter only domain Emails" multi="true" name="sendReceipientEmail" type="Identity">
<Attributes>
<Map>
<entry key="hidden">
<value>
<Script>
<Source>
import sailpoint.object.*;
Filter f = Filter.like("email", "domain.com");
field.setFilterString(f.toString());
</Source>
</Script>
</value>
</entry>
</Map>
</Attributes>
<ValidationScript>
<Source>
import sailpoint.object.*;
import java.util.*;
if(value!= null @and value.size() > 0){
for(String idenName:value){
Identity idenObj = context.getObjectByName(Identity.class, idenName);
if(idenObj!=null){
if(idenObj.getEmail() != null){
String val= idenObj.getEmail().toLowerCase();
if(!val.contains("domain.com")){
return "Please select domain Email";
}
}else{
return "Please select domain Email";
}
}
}
}
</Source>
</ValidationScript>
</Field>
You can writer validation script (ValidationScript) in the field level
@sureshbommareddy98
Forms.pdf (338.3 KB)
ValidationScript Script used to examine and validate the field value
entered by the user; value entered is passed to the
Validation Script in the variable named "value"
<ValidationScript>
<Source>
if (value > 10) {
return "Value must be less than or equal to 10";
Forms 7.0+
32
else
return null;
</Source>
</ValidationScript>
Should be written to return null if no errors and return
error message (as string or Sailpoint.tools.message
object) if validation errors exist```
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.