Hidden Fields in Sailpoint IIQ

I am creating a form in which i need to hide and unhide below field according to the option selected in the dropdown field. I wrote a code which is showing system error when i am trying to open the form using quicklink. The code is below.

<Field displayName="select" dynamic="true" name="Field 6" postBack="true" required="true" type="string">

<AllowedValues Definition>

<Value>

<<List>

<String>Modify Existing Service Account Name</String>

<String>Modify Existing Service Account Description</String>

</List>

</Value>

</AllowedValues Definition>

</Field>

<Field displayName="Enter existing Service Account Name" helpKey="Enter existing group name from the domain which requires to be Modified/Deleted/Transfer Owner Ship." name="Field 7" required="true" type="string"/>

<Field displayName="Enter new Service account Name" dynamic="true" helpKey="Enter new name of the group that should be created or modified in the domain." name="Field 8" required="true" type="string">

<Attributes>

<Map>

<entry key="hidden">

<value>

<Script>

<Source>

boolean hideField = false;

if(!("Modify Existing Service Account Description".equalsIgnoreCase (Field 6))) {

hideField= true; 
field.setRequired(false);
}

else {

hideField = false;

field.setRequired(true);
}

return hideField:

</Source>

</Script>

</value> </entry>

</Map>
</Attributes>
</Field>

Hi @pctripathi,

I did somethings similar for Edit Identity form but I think you can apply for other type of forms.

I created a checkbox and rule.
The rule is assigned to the section that I want hide/unhide to hidden attribute. The rule check the state of checkbox and return true or false:

Form

<Section name="Checkbox">
    <Field displayName="check" name="check" postBack="true" type="boolean"/>
</Section>
<Section label="HiddenSection" name="HiddenSection">
    <Attributes>
        <Map>
            <entry key="hidden" value="rule:Rule"/>
        </Map>
    </Attributes>
</Section>

Rule

Field field = form.getSection("Checkbox").getField("check");
Boolean hidden = true;
if(field != null){
    if (field.getValue() != null && field.getValue()){
        hidden = false;
    }
}
return hidden;

you can change it for your necessity
say to me, if it help you with your problem

1 Like

Check below sample

    <Field defaultValue="level5" displayName="Access Request -  Approval Level" displayType="combobox" helpKey="Please select the appropriate approval level" name="approvalLevel" postBack="true" type="string">
      <AllowedValues>
        <String>level1</String>
        <String>level4</String>
        <String>level5</String>
      </AllowedValues>
    </Field>
    <Field columnSpan="2" displayName="Name of Entitlement Owner" dynamic="true" multi="true" name="groupOwner" type="identity">
      <Attributes>
        <Map>
          <entry key="hidden">
            <value>
              <Script>
                <Source>

                  if(approvalLevel != null){
                  String levelOfAppr=(String) approvalLevel;
                  if(levelOfAppr.equals("level5)|| levelOfAppr.equals("level4"))   
                  {
                  return false;
                  }else{
                  return true;
                  }
                  }else{
                  return true;
                  }
                </Source>
              </Script>
            </value>
          </entry>
        </Map>
      </Attributes>
    </Field>
1 Like

@pctripathi

try this approach also,

<Field displayName="select" dynamic="true" name="Field 6" postBack="true" required="true" type="string">

<AllowedValues Definition>

<Value>

<<List>

<String>Modify Existing Service Account Name</String>

<String>Modify Existing Service Account Description</String>

</List>

</Value>

</AllowedValues Definition>

</Field>

<Field displayName="Enter existing Service Account Name" helpKey="Enter existing group name from the domain which requires to be Modified/Deleted/Transfer Owner Ship." name="Field 7" required="true" type="string"/>

<Field displayName="Enter new Service account Name" dynamic="true" helpKey="Enter new name of the group that should be created or modified in the domain." name="Field 8" required="true" type="string">

<Attributes>

<Map>

<entry key="hidden">

<value>

<Script>

<Source>


import sailpoint.object.Field;

Field f6 = form.getField("Field 6");
String f6value = f6.getValue();
boolean hideField = false;

if(!("Modify Existing Service Account Description".equalsIgnoreCase (f6value))) {

hideField= true; 
field.setRequired(false);
}
else {

field.setRequired(true);
}
return hideField;

</Source>

</Script>

</value> 
</entry>

</Map>
</Attributes>
</Field>

One more option you have like,

a. Create a Hidden Section for process the field.
- Here you can create Field, that will read the value from any field and you can hide / unhide multiple fields and change the read only also.

Let me know if you need some samples.

1 Like

@pctripathi I agree with @pravin_ranjan approach. Hidden field is always helpful if we want to do some background processing and then use that field value wherever its required. Thankyou Sir.

2 Likes

Thank you @pravin_ranjan.
The solution you provided is working fine.

Hi @pravin_ranjan
Sharing a template for that is appreciated. That will help me in long run.

Hi @enistri_devo
Thanks for your solution. I am sure I will be using your piece of code further.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.