Limit HR Services based on the Topic detail and Topic category

kartikey
Tera Contributor

Hi Everyone,

i wish to limit the HR services based on the topic detail and topic category selected on the HR case creation form.
i've added the topic detail and topic category field on the case creation configuration page (sn_hr_core_config_case_creation).
how to narrow down HR services based on my selection of the two fields(topic detail & topic category) ?
currently it shows all the services of the COE selected.

kartikey_0-1692612612618.png

 

1 REPLY 1

JamesEcoStratus
Mega Guru

I’ll try to help based on the information you’ve provided.

 

You can use catalog client scripts and UI policies to limit HR services based on the selections of Topic Detail and Topic Category fields on the HR case creation form in ServiceNow.

 

Here are the steps to achieve this:

Identify the HR Services Dependencies: Before implementing the restrictions, you need to identify which HR services are dependent on specific Topic Details and Topic Categories. You might need to maintain this information somewhere, like a table or script, to map services to relevant Topic Details and Topic Categories.

 

Create a Catalog Client Script:

 

Navigate to "Service Catalog" > "Catalog Client Scripts."

Click "New" to create a new client script.

Name the script something like "Restrict HR Services by Topic."

Set the script to run "onLoad" for the HR case creation form.

Write the Client Script Logic:

 

In your client script, you'll need to use JavaScript to filter and restrict the HR services based on the selected Topic Detail and Topic Category.

 

Here's a simplified example:

 

Screenshot 2023-09-04 at 14.51.10.png

 

Create a Catalog UI Policy:

 

Navigate to "Service Catalog" > "Catalog UI Policies."

Click "New" to create a new UI policy.

Configure the UI policy to conditionally hide the "HR Service" field when necessary.

Use the "Advanced" tab to apply the UI policy when specific conditions are met.

Test the Functionality:

 

Now, when users open the HR case creation form and select Topic Detail and Topic Category, the HR Service field will be dynamically filtered based on the selected values.

Please note that this is a simplified example, and you may need to adapt the code to your specific data structure and requirements. Additionally, consider adding error handling and validation to ensure a smooth user experience.

 

Good Luck,

 

James