Hiding fields in a form

Hi All Can anyone help on this scenario as In the form shown below
When IdentityType = PermanentEmployee,
the EndContract field should disappear or be disabled (not required / not visible) How can i do this ? I tried a validation rule but its not working

@uditsahntl01 -

To achieve the desired results you need to follow below steps -

  1. For the IdentityType attribute add the argument postBack="true" as shown below
<Field displayName="IdentityType" displayType="combobox" name="type" postBack="true" type="string">
      <AllowedValuesDefinition>
        <Value>
          <List>
            <String>employee</String>
            <String>contractor</String>
          </List>
        </Value>
      </AllowedValuesDefinition>
    </Field>
  1. Against Your EndContract attribute β†’ Type Setting β†’ Hidden β†’ Set it as Rule and add the rule something similar to -
if("employee".equals(type))
{
return false;
}
else{
return true;
}

That’s it.

Cheers!!!

1 Like
<!DOCTYPE Form PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Form created="1702137497439" id="a9fe61c08c411945818c4f4d075f0b0c" modified="1745906467153" name="AirlineForm" type="Workflow">
  <Attributes>
    <Map>
      <entry key="pageTitle" value="AirlineForm"/>
    </Map>
  </Attributes>
  <Section name="Main">
    <Field displayName="Employee ID" helpKey="Specify the first name for Identity" name="employeeId" type="sailpoint.object.Identity"/>
    <Field displayName="UserName" helpKey="Select application name" name="appName" type="string"/>
    <Field displayName="IdentityType" displayType="combobox" name="type" postBack="true" required="true" type="string">
      <AllowedValuesDefinition>
        <Value>
          <List>
            <String>employee</String>
            <String>contractor</String>
          </List>
        </Value>
      </AllowedValuesDefinition>
    </Field>
    <Field displayName="EndContract" name="endContract" type="string">
      <Attributes>
        <Map>
          <entry key="hidden">
            <value>
              <Script>
                <Source>if("employee".equals(type))
{
return true;
}
else{
return false;
}</Source>
              </Script>
            </value>
          </entry>
        </Map>
      </Attributes>
    </Field>
    <Field displayName="Password" name="password" type="secret"/>
    <Field displayName="Password Confirmation" name="passwordConfirmatoin" type="secret"/>
    <Field displayName="Job Title" name="jobTitle" type="string">
      <AllowedValuesDefinition>
        <Value>
          <List>
            <String>Developer</String>
            <String>Tester</String>
          </List>
        </Value>
      </AllowedValuesDefinition>
    </Field>
  </Section>
  <Button action="next" label="Save Identity"/>
  <Button action="cancel" label="Cancel"/>
</Form>