Hidden field based on identity

Share all details about your problem, including any error messages you may have received.

I have a field named user, if the user is in inactive state then I want the “Agree” checkbox field to be hidden and if the user is active then the checkbox is not hidden.

The user field value is stored as flag and I am returning the hasInvalidStatus flag(true/false). So I want help to write if the flag value is true then hide the AGree field and Submit button else show.

<Section name="User Info">
boolean hasInvalidStatus = false;
<<this section I am taking the user input and returning the flag hasInvalidStatus=true or hasInvalidStatus=false>>
return hasInvalidStatus;
</Section>
        <Section name="ValidationWarning">
          <Attributes>
            <Map>
              <entry key="hidden">
                <value>
                  <Script>
                    <Source>                                
                      if ("true".equalsIgnoreCase(String.valueOf(hasInvalidStatus))) 
                      {                    
                      return false;                  
                      }                       
                      return true;              
                    </Source>
                  </Script>
                </value>
              </entry>
            </Map>
          </Attributes>
          <Field displayName="" name="validationWarning" type="string"/>
        </Section>

        <Section name="I confirm that the details entered are correct.">
          <Attributes>
            <Map>
              <entry key="hidden">
                <value>
                  <Script>
                    <Source>       
                    if(form.getFieldValue(false)) {                   
                      <<then hide>>                 
                      }                           
                          <<not hide>>      
                    </Source>
                  </Script>
                </value>
              </entry>
              <entry key="subtitle" value="I confirm that the details entered are correct"/>
            </Map>
          </Attributes>
          <Field displayName="Agree" name="action" required="true" type="boolean"/>
        </Section>
<Button action="next" label="Submit" value="submit"/>

If you’re trying to conditionally hide the “Agree” checkbox and Submit button in a SailPoint IIQ form based on the user’s status, you can achieve this using the hidden attribute with a script that evaluates the hasInvalidStatus flag.

Assuming you’re setting hasInvalidStatus = true when the user is inactive, here’s how you can structure your form:

<Section name="User Info">
  <Script>
    <Source>
      boolean hasInvalidStatus = false;
      // Your logic to determine user status
      // Example: hasInvalidStatus = user.getStatus().equals("inactive");
      return hasInvalidStatus;
    </Source>
  </Script>
</Section>

<Section name="I confirm that the details entered are correct.">
  <Attributes>
    <Map>
      <entry key="hidden">
        <value>
          <Script>
            <Source>
              if ("true".equalsIgnoreCase(String.valueOf(hasInvalidStatus))) {
                return true; // Hide the section
              }
              return false; // Show the section
            </Source>
          </Script>
        </value>
      </entry>
    </Map>
  </Attributes>

  <Field displayName="I Agree" name="agreeCheckbox" type="boolean">
    <Attributes>
      <Map>
        <entry key="hidden">
          <value>
            <Script>
              <Source>
                if ("true".equalsIgnoreCase(String.valueOf(hasInvalidStatus))) {
                  return true; // Hide checkbox
                }
                return false; // Show checkbox
              </Source>
            </Script>
          </value>
        </entry>
      </Map>
    </Attributes>
  </Field>

  <Field displayName="Submit" name="submitButton" type="submit">
    <Attributes>
      <Map>
        <entry key="hidden">
          <value>
            <Script>
              <Source>
                if ("true".equalsIgnoreCase(String.valueOf(hasInvalidStatus))) {
                  return true; // Hide submit button
                }
                return false; // Show submit button
              </Source>
            </Script>
          </value>
        </entry>
      </Map>
    </Attributes>
  </Field>
</Section>

Points to Note:

  • Make sure hasInvalidStatus is accessible in the scope where you’re referencing it.
  • If you’re calculating it in a different section, consider using a global variable or storing it in a field that can be referenced later.