Change what fields are visible on HR Case Creation screen based on something other than HR Service

Lyndsay Greer
Tera Expert

When creating an HR case, how can I show and hide fields based on something other than the HR Service? The Case Creation Configuration only allows me to change what fields are displayed based on what HR Service is selected. I need to show/hide fields based on other criteria, like whether the case's source(contact_type) is Phone or In-person, or whether the logged-in user is a member of a specific group. Any ideas?

1 ACCEPTED SOLUTION

Bhavesh Bijagar
Tera Guru

Hi @Lyndsay Greer 

 

There isn’t a built-in, out-of-the-box way to conditionally display fields during HR case creation without applying some level of customization.

 

While the "Case Creation Service Configuration" allows you to control which fields appear based on the selected HR Service, any deeper customization—such as dynamically altering the layout or behavior of the case creation page—requires direct changes to the "case_creation" UI Page. If you choose to go this route, follow these steps:

  • Locate the UI Page: Go to System UI > Pages and find case_creation.
  • Clone Before Editing: Always create a clone of the original page to preserve the default configuration.
  • Modify Client Scripts: Adjust the client-side logic to manage field visibility, validation, or dynamic behavior.
  • Edit HTML Layout: Customize the form layout, add or remove fields, and tailor the visual presentation as needed.

However, this approach involves significant customization and maintenance overhead, and is generally not recommended unless absolutely necessary.


Instead of customizing the UI Page, allow the case to be created using the standard case_creation page, and then use UI Policies on the HR Case form to dynamically show or hide fields based on specific conditions (e.g., HR Service, case type, or user role).

 

This method is more maintainable, upgrade-safe, and aligns with ServiceNow best practices.

View solution in original post

5 REPLIES 5

Abbas_5
Tera Sage
Tera Sage

Hello @Lyndsay Greer,

 

You can utilise UI policies to dynamically change the visibility of fields on an HR case creation screen in ServiceNow. These policies allow you to set field visibility based on the values of other fields, including fields other than the "HR Service" field.
 
Here's a breakdown of how to achieve this:
 
1. Identify the Trigger Field: Determine which field on the case creation form will determine the field visibility. This could be any field, such as a "Case Type", "Company", or a custom field you've created.
 
2. Configure the UI Policy:
 
  • Navigate to the table that contains the HR case creation form (usually sn_hr_core).
  • Go to the "UI Policies" module and create a new UI policy.
  • Set the "Table" to the HR case table and give the policy a descriptive name.
  • In the "Conditions" section, define the condition based on the trigger field. For example, if you want to make a field visible when a certain "Case Type" is selected, set the condition to "Case Type equals [Specific Case Type]".
  • In the "Actions" section, select the "Actions" to perform when the condition is met. Choose "Field" and specify the field you want to make visible or invisible.
  • Set the "State" to "Visible" or "Hidden" based on your requirement.
  • Click "Submit" to save the UI policy.
3. Test the UI Policy: 
 
  • Create a few test cases on the HR case creation form, ensuring the trigger field is set to different values.
  • Verify that the visibility of the targeted fields changes according to the UI policy you defined.
Example:
Let's say you want to make a "Salary Adjustment" field visible only when the "Case Type" is set to "Compensation." 
 
  1. Trigger Field: Case Type
  2. UI Policy Configuration:
    • Condition: Case Type equals "Compensation"
    • Action: Set field "Salary Adjustment" to "Visible"
By using UI policies, you can effectively control the visibility of fields on your HR case creation form based on a variety of conditions, not just the "HR Service" field.
 
If it is helpful, please hit the thumbs up icon and accept the correct solution by referring to this solution in future it will be helpful to them.
 
Thanks & Regards,
Abbas Shaik

Thank you for the reply! I did try a UI policy but it isn't working. I tried in both a subprod instance, and also in my PDI, and the u_test_field still shows on the case creation screen. What am I missing?

 

Here is the UI policy: 

ui policy test field.jpg

 

And here is my Case Creation Configuration:

case creation.jpg

 

But here is the case creation screen, and Test Field is still visible, no matter which HR Service I select: 

 

general inquiry case.jpg

Bhavesh Bijagar
Tera Guru

Hi @Lyndsay Greer 

 

There isn’t a built-in, out-of-the-box way to conditionally display fields during HR case creation without applying some level of customization.

 

While the "Case Creation Service Configuration" allows you to control which fields appear based on the selected HR Service, any deeper customization—such as dynamically altering the layout or behavior of the case creation page—requires direct changes to the "case_creation" UI Page. If you choose to go this route, follow these steps:

  • Locate the UI Page: Go to System UI > Pages and find case_creation.
  • Clone Before Editing: Always create a clone of the original page to preserve the default configuration.
  • Modify Client Scripts: Adjust the client-side logic to manage field visibility, validation, or dynamic behavior.
  • Edit HTML Layout: Customize the form layout, add or remove fields, and tailor the visual presentation as needed.

However, this approach involves significant customization and maintenance overhead, and is generally not recommended unless absolutely necessary.


Instead of customizing the UI Page, allow the case to be created using the standard case_creation page, and then use UI Policies on the HR Case form to dynamically show or hide fields based on specific conditions (e.g., HR Service, case type, or user role).

 

This method is more maintainable, upgrade-safe, and aligns with ServiceNow best practices.

Thank you! We definitely don't want to customize the "case_creation" UI Page.