I have created Three fields.
1st field = Options to be selected
2nd and 3rd Field will be visible based on the options selected above.
<Section name="Section 1">
<Field displayName="Requesting For" displayType="radio" name="Selection" postBack="true" required="true" type="string">
<AllowedValuesDefinition>
<Value>
<List>
<String>Option One</String>
<String>Option Two</String>
</List>
</Value>
</AllowedValuesDefinition>
</Field>
<Field displayName="Select ID" dynamic="true" name="First" postBack="true" type="sailpoint.object.Identity">
<Attributes>
<Map>
<entry key="hidden">
<value>
<Script>
<Source>
import sailpoint.object.Field;
boolean hideField = !"Option One".equalsIgnoreCase(form.getField("Selection").getValue());
field.setRequired(!hideField);
return hideField;
</Source>
</Script>
</value>
</entry>
</Map>
</Attributes>
</Field>
<Field displayName="Enter ID" dynamic="true" name="Second" postBack="true" type="string">
<Attributes>
<Map>
<entry key="hidden">
<value>
<Script>
<Source>
import sailpoint.object.Field;
boolean hideField = !"Option Two".equalsIgnoreCase(form.getField("Selection").getValue());
field.setRequired(!hideField);
return hideField;
</Source>
</Script>
</value>
</entry>
</Map>
</Attributes>
</Field>
</Section>
In case the option is long or there are alot of options, adding options in everyfield is a bit lengthy.
So I descided to use index. Here I will define all the options in a list and the fields will contain 0,1,2 … to hide or unhide them but did not work.
Also I tried giving value to every option like 0 or 1 and tried, it also seems not supported or something.
Any different approach I can try?