- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 10:32 AM - edited 01-03-2025 10:32 AM
Trying to determine the best way to do this in catalog builder form.
Lets say I have a lookup select box called 'Department' and when I select an option from that box I want to populate and/or filter another lookup select box to just have options based on the value selected in department.
Is there a built in way to do this or do I need to write script to clear the options from the box and create new options based on a query?
I am needing to do this on a service portal form.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 10:49 AM
Are both fields reference fields? Sounds like you'd want a reference qualifier script. If the logic is simple you may be able to write the reference qualifier inline, or if it's complex you'd want to create a script include and call it in the reference qualifier field:
javascript:new myScriptInclude().my_refqual()
See: https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/script/server-scripting/c...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 10:49 AM
Are both fields reference fields? Sounds like you'd want a reference qualifier script. If the logic is simple you may be able to write the reference qualifier inline, or if it's complex you'd want to create a script include and call it in the reference qualifier field:
javascript:new myScriptInclude().my_refqual()
See: https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/script/server-scripting/c...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 06:52 AM - edited 01-06-2025 06:53 AM
they are not reference fields as reference fields don't seem to allow me to have multiple things searchable on the service portal. it only shows the display field.
Is there a way to pre-fill the seach box on a lookup select box? that would be fine also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2025 01:42 AM
Hello, @bigbacon
Define the Relationship Between Fields
Ensure the fields you're working with are reference fields or choice fields:
The Department field should reference a table containing department data.
The dependent field (e.g., Team) should reference a table that has a relationship to the Department table, such as a field that links each team to a department.
Step 2: Configure the Dependent Field
Navigate to the dependent field's dictionary entry:
Go to System Definition > Tables.
Open the table that contains the dependent field (e.g., Team).
Locate and edit the dictionary entry for the dependent field.
Set a Reference Qualifier:
In the dictionary entry for the dependent field, set the Reference Qualifier to "Dynamic."
Choose an existing dynamic reference qualifier or create a new one that filters records based on the value of the Department field.
For example:
Reference Qualifier Condition: Department == current.department.
Step 3: Test the Configuration
Open the catalog item in the Catalog Builder or Service Portal.
Select a department from the Department field.
Verify that the options in the dependent field update dynamically based on the department selection.
Step 4: Use Variable Dependencies for Choice Fields (If Applicable)
If the fields are choice fields rather than reference fields:
Navigate to the catalog item form.
Edit the dependent variable (e.g., Team) and use the Depends on field.
Specify the Department field as the dependency.
Advantages of No-Code Configuration
Easier Maintenance: Changes can be made directly through the UI without modifying scripts.
Standardized Approach: Utilizes out-of-the-box ServiceNow features, reducing customization overhead.
Improved Security: Prevents exposing sensitive logic or data through custom scripts.
Let me know if you'd like more details or help configuring a specific scenario!
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 11:58 AM
what if you don't want to use refernce type fields? Unless there is something I am msising, reference fields in service portal suck. Select boxes I can configure to show multiple fields in the lookup in order to make it easier (so like department name and number) where as the reference fields only seem to let you use the display field. This also allows to search across those multiple fields to shorten the list.