I have created the following drop-down in my create identity form:
<Field displayName="Type of Account" helpKey="Choose from the following in the dropdown: AA, ZZ or Regular Account" name="adminacct" postBack="true" required="true" type="string">
<AllowedValuesDefinition>
<Value>
<List>
<String>AA</String>
<String>ZZ</String>
<String>Regular Account</String>
</List>
</Value>
</AllowedValuesDefinition>
</Field>
What I would like to see performed is when one of the 3 above is chosen, then another drop-down automatically comes up right after the selection with whatever choices are the result of the above choice. Could you please assist on how this would be written?
I have already made a custom object as shown below if “AA” is the chosen one.
You would need to set the needed fields to be dynamic and use dependencies. You can also set a field to hidden and un-hide it via a filed script that’s updated when a different field is set. It’s not noted in the documentation here I don’t think, but the hidden attribute exists and works for individual fields the same way it does for form sections.
Implement your second field in this way, it will help you achieve what you needed, I assume you wanted to show only the keys in custom object based on the First field selection
<Field displayName="Account Name" dependancies="adminacct" helpKey="Choose from the following in the dropdown" name="acctName" postBack="true" dynamic="true" required="true" type="string">
<AllowedValuesDefinition>
<Script>
<Source>
import sailpoint.object.Form;
import sailpoint.object.Field;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import sailpoint.object.Custom;
import sailpoint.object.Attributes;
String selectedValue = form.getFieldValue("adminacct");
List&tl;String> options = new ArrayList<String>();
if (selectedValue != null) {
if (selectedValue.equals("AA")) {
Custom customObject = context.getObjectByName(Custom.class, "AA Admin Titles");
if (customObject != null) {
Map mapAttribute = customObject.getAttributes();
options = new ArrayList<String>(mapAttribute.keySet());
}
}
else if (selectedValue.equals("ZZ")) {
Custom customObject = context.getObjectByName(Custom.class, "ZZ Admin Titles");
if (customObject != null) {
Map mapAttribute = customObject.getAttributes();
options = new ArrayList<String>(mapAttribute.keySet())
}
}
}
return options;
</Source>
</Script>
</AllowedValuesDefinition>
</Field>
The script saved correctly but when I go back to form, it does not list the names from my AA Admin Titles custom objects. it only list the numbers as shown below:
And if you are using Custom object in this format , you might have to change the script slightly. mapAttribute.keySet() to mapAttribute.get("Attributes")
<Field dependencies="adminacct" displayName="Account Name" dynamic="true" helpKey="Choose from the following in the dropdown" name="acctName" postBack="true" required="true" type="string">
<AllowedValuesDefinition>
<Script>
<Source>
import sailpoint.object.Form;
import sailpoint.object.Field;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import sailpoint.object.Custom;
import sailpoint.object.Attributes;
String selectedValue = form.getField("adminacct").getValue();
List options = new ArrayList();
if (selectedValue != null) {
if (selectedValue.equals("AA")) {
Custom customObject = context.getObjectByName(Custom.class, "AA Admin Titles");
if (customObject != null) {
Map mapAttribute = customObject.getAttributes();
options = new ArrayList(mapAttribute.get("Attributes"));
}
} else if (selectedValue.equals("ZZ")) {
Custom customObject = context.getObjectByName(Custom.class, "ZZ Admin Titles");
if (customObject != null) {
Map mapAttribute = customObject.getAttributes();
options = new ArrayList(mapAttribute.keySet());
}
}
}
return options;
</Source>
</Script>
</AllowedValuesDefinition>
</Field>
Are trying to implement the exact same thing, or it is something siilar. I would suggest you start a new post mentioning your issue, provide more information about your issue like what were you doing that led to this, where did you see it, what version of IIQ are you on, logs etc