scholleti
(Sandeep Cholleti)
January 25, 2023, 10:04am
1
Hi,
Can someone help me on the below, with sample code
I have two fields(hiretype,user) in the form, if “hiretype” Field is selected as Non-Employee, then i need to hide the “user” Field.
<Field displayName=“Hire Type” displayType=“combobox” name=“hiretype” required=“true” type=“string”>
<AllowedValues>
<String>Employee</String>
<String>Non-Employee</String>
</AllowedValues>
</Field>
<Field displayName=“Select User” name=“user” type=“sailpoint.object.Identity”>
<Attributes>
<Map>
<entry key=“filterString”>
<value>
<Script>
<Source>
import sailpoint.object.*;
Field uservalue = form.getField(“user”);
Filter filter = Filter.or(Filter.eq(“inactive”, false), Filter.isnull(“inactive”));
uservalue.setFilterString(filter.toString());
</Source>
</Script>
</value>
</entry>
</Map>
</Attributes>
</Field>
Thanks,
Sandeep
Hello, you can use the tag as
<entry key="hidden">
on the form field and write a source script to get the other field value and do a empty check or your data check and return true/false for controlling visibility
sample example
<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 Approvers" 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>
<entry key="readOnly" value="true"/>
</Map>
</Attributes>
</Field>
scholleti
(Sandeep Cholleti)
January 26, 2023, 4:43pm
4
Thank you Vishal for sharing sample example. Now I am able to hide the fields.
Regards,
Sandeep