Hi,
I am using a Script to hide and unhide field where I am using the exact data the list have but instead I want to use list’s index to hide or unhide the field.
My code:
<Section label="Requesting For" name="Section 1">
<Field displayName="Select" name="Field_1" postBack="true" required="true" type="string">
<AllowedValuesDefinition>
<Value>
<List>
<String>Option 1</String>
<String>Option 2</String>
</List>
</Value>
</AllowedValuesDefinition>
</Field>
<Field displayName="Enter Data" dynamic="true" name="Field_2" postBack="true" required="true" type="sailpoint.object.Identity">
<Attributes>
<Map>
<entry key="hidden">
<value>
<Script>
<Source>
import sailpoint.object.Field;
Field f1 = form.getField("Field_1");
String f1value = f1.getValue();
boolean hideField = false;
if(!("Option 1".equalsIgnoreCase (f1value))) {
hideField= true;
field.setRequired(false);
}
else {
field.setRequired(true);
}
return hideField;
</Source>
</Script>
</value>
</entry>
</Map>
</Attributes>
</Field>
<Field displayName="Enter Data" dynamic="true" name="Field_3" postBack="true" required="true" type="string">
<Attributes>
<Map>
<entry key="hidden">
<value>
<Script>
<Source>import sailpoint.object.Field;
Field f1 = form.getField("Field_1");
String f1value = f1.getValue();
boolean hideField = false;
if(!("Option 2".equalsIgnoreCase (f1value))) {
hideField= true;
field.setRequired(false);
}
else {
field.setRequired(true);
}
return hideField;</Source>
</Script>
</value>
</entry>
</Map>
</Attributes>
</Field>
</Section>
Instead of using “Option 1” directly i.e. the 0th data in the list of options I want to use the 0 to the field which I want to show when 0th index data is selected from the list.
I tried using Index != 0, but its not working.