How to set defaultValue for a Form Field of type Radio

Hi Sailors,

I’m working on one custom form and field of type radio.I’m adding list of values into allowed value definition like below, Problem is that i’m unable to select default value in below Radio buttons.

<Field columnSpan="1" displayName="User Purpose" displayType="radio" dynamic="true" name="Purpose" postBack="true" type="string">
      <AllowedValuesDefinition>
        <Script>
          <Source>
            import sailpoint.object.Custom;
            import sailpoint.tools.Util;
 
    List mailboxPorposeList = new ArrayList();
    List&lt;String> businessList = new ArrayList();
    List&lt;String> nonBusinessList = new ArrayList();   
    
           mailboxPorposeList.add(businessList);
               mailboxPorposeList.add(nonBusinessList);
             return mailboxPorposeList;    
          </Source>
        </Script>        
      </AllowedValuesDefinition>   
  </Field>

Could you please guide me, how to select default value using script from added list of AllowedValuesDefinition.

Hi @gavhanet.

put in the field the argument value, like this:

<Field columnSpan="1" displayName="User Purpose" displayType="radio" dynamic="true" name="Purpose" postBack="true" type="string" value="defaultvalue">

Thanks for the quick response, i want to select of the value generated from the AllowedValuesDefinition List.

you can use the setValue instruction:

form.getSection("section").getField("Purpose").setValue(mailboxPorposeList.get(X))

Change section with the section that you have and X with the number of element of the list that you want.

I use this in a rule, but I am not sure it works in a script.