RIsidoro
(Ricardo Isidoro)
March 6, 2025, 10:05am
1
Which IIQ version are you inquiring about?
8.2
Hello all,
I have some form in an application in my sailpoint with several fields.
I have this field with 2 radio buttons
<Field displayName="Atua " name="xxx" required="true" type="string">
<AllowedValuesDefinition>
<Value>
<List>
<String>Sim</String>
<String>Não</String>
</List>
</Value>
</AllowedValuesDefinition>
</Field>
I want that when “Sim” is check the value is “123”
when “Não” is check the value is “321”
I already tried to create the script bu didn’t worked
Thank you all
Hi @RIsidoro ,
you need to return a Map\HashMap or a List<Int,String> for example. Where in the first attribute you put the value you want to return and in the second the value you want to display.
Hi and Hello,
you want something like that?
<![CDATA[
import sailpoint.object.Identity;
import sailpoint.api.SailPointContext;
String selectedValue = form.get("xxx");
if ("Sim".equals(selectedValue)) {
form.put("xxx", "123");
} else if ("Não".equals(selectedValue)) {
form.put("xxx", "321");
}
]]>
Regards,
Adam
3 Likes
RIsidoro
(Ricardo Isidoro)
March 6, 2025, 5:22pm
4
Adam Waszak:
import sailpoint.object.Identity;
import sailpoint.api.SailPointContext;
String selectedValue = form.get("xxx");
if ("Sim".equals(selectedValue)) {
form.put("xxx", "123");
} else if ("Não".equals(selectedValue)) {
form.put("xxx", "321");
}
I have this
<Field displayName="Atua " name="xxx" required="true" type="string">
<AllowedValuesDefinition>
<Value>
<List>
<String>Sim</String>
<String>Não</String>
</List>
</Value>
</AllowedValuesDefinition>
<Script>
<Source>
import sailpoint.object.Identity;
import sailpoint.api.SailPointContext;
String selectedValue = form.get("xxx");
if ("Sim".equals(selectedValue)) {
form.put("xxx", "123");
} else if ("Não".equals(selectedValue)) {
form.put("xxx", "321");
}
</Source>
</Script>
</Field>
When I run I have the error
<!DOCTYPE List PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<List>
<Message key="err_exception" type="Error">
<Parameters>
<Message key="Typed variable declaration : Attempt to resolve method: get() on undefined variable or class name: form : at Line: 4 " type="Error"/>
</Parameters>
</Message>
</List>
use a script for the AllowedValuesDefinition where you return a list or a map, not a value script
RIsidoro
(Ricardo Isidoro)
March 6, 2025, 5:33pm
6
Do you mean something like : Still didnt worked and the radio buttons changed for a textbox
<Field displayName="Atua " name="xxx" required="true" type="string">
<AllowedValuesDefinition>
<Script>
<Source>
import sailpoint.object.Identity;
import sailpoint.api.SailPointContext;
String selectedValue = form.get("xxx");
if ("Sim".equals(selectedValue)) {
form.put("xxx", "123");
} else if ("Não".equals(selectedValue)) {
form.put("xxx", "321");
}
</Source>
</Script>
<Value>
<List>
<String>Sim</String>
<String>Não</String>
</List>
</Value>
</AllowedValuesDefinition>
</Field>
give it try below
<AllowedValuesDefinition>
<Script>
<Source>
import sailpoint.object.*;
import sailpoint.api.SailPointContext;
Field selectedValue = form.getField("xxx");
if ("Sim".equals(selectedValue.getValue())) {
// return "123";
selectedValue.setValue("123");
} else if ("Não".equals(selectedValue)) {
// return "321";
selectedValue.setValue("321");
}
</Source>
</Script>
<Value>
<List>
<String>Sim</String>
<String>Não</String>
</List>
</Value>
</AllowedValuesDefinition>
<Field displayName="Atua " name="xxx" required="true" type="string">
<AllowedValuesDefinition>
<Script>
<Source>
HashMap selectedValue = new HashMap();
selectedValue.put("123", "Sim");
selectedValue.put("123", "Não");
return selectedValue;
</Source>
</Script>
</AllowedValuesDefinition>
</Field>
like this, and if you want return a value but you want display another, IIQ will use a combo box not radio button.
Ps if you problem with maps, try with a list
RIsidoro
(Ricardo Isidoro)
March 6, 2025, 5:49pm
11
@enistri_devo with this I only have one radio button witn nothing on it and i cant click ok
change the first value of the second element:
selectedValue.put("123", "Sim");
selectedValue.put("456", "Não");
Hi and Hello,
Maybe step back.
What you have now(code) and what error you have?
Regards,
Adam
4 Likes
Ricardo Isidoro:
AllowedValuesDefinition
give it a try below but it will show drop down on UI
<Field displayName="priority" helpKey="Priority" name="priority">
<AllowedValuesDefinition>
<Value>
<List>
<List>
<String>Low</String>
<String>Lower</String>
</List>
<List>
<String>High</String> <!-- This will be returned -->
<String>Higher</String> <!-- This will show on UI -->
</List>
</List>
</Value>
</AllowedValuesDefinition>
</Field>
hope it works!
RIsidoro
(Ricardo Isidoro)
March 7, 2025, 11:37am
16
Hello @kalyan_dev32
This works and is almost what I want.
The Low part is ok
But the Higher I want to appear "Higher " but the string to pass be empty
But like this the Higher dont appear
<Field displayName="priority" helpKey="Priority" name="priority">
<AllowedValuesDefinition>
<Value>
<List>
<List>
<String>Low</String>
<String>Lower</String>
</List>
<List>
<String></String> <!-- This will be returned -->
<String>Higher</String> <!-- This will show on UI -->
</List>
</List>
</Value>
</AllowedValuesDefinition>
</Field>```
Hey @RIsidoro
Check this below
<Field displayName="Atua" name="xxx" required="true" type="string">
<AllowedValuesDefinition>
<Value>
<List>
<String>Sim</String>
<String>Não</String>
</List>
</Value>
</AllowedValuesDefinition>
<Script>
<Source>
if (value != null) {
if (value.equals("Sim")) {
return "123";
} else if (value.equals("Não")) {
return "321";
}
}
return value;
</Source>
</Script>
</Field>
Let me know if it doesn’t work.
RIsidoro
(Ricardo Isidoro)
March 7, 2025, 5:45pm
18
In my case simple null solved the issue
Thanks for all your help
Value>
<List>
<List>
<String>Low</String>
<String>Lower</String>
</List>
<List>
<String>null</String>
<String>Higher</String>
</List>
</List>
</Value>
2 Likes
system
(system)
Closed
May 6, 2025, 5:45pm
19
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.