query on table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have a requirement in a custom table with three fields: Model Category, Model, and Location.
The form should guide users to fill these fields in a specific sequence:
- First, the user must select Model Category
- Then, based on the selected category, the user can choose Model
- Finally, the user should select Location
I want to configure this in a user-friendly and controlled way so users cannot skip the sequence.
How can I make?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you can't force but then why not show the 2nd when 1st is populated and show 3rd when 2nd is populated?
you can handle this using onChange client script on 1st and 2ne field
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @vodnalar26
Try this way..
Assumption is your custom table isu_custom_model_data.
Its having 3 fields
Model Category (Type: Reference to cmdb_model_category)
Model (Type: Reference to cmdb_model or cmdb_hardware_product_model)
Location (Type: Reference to cmn_location)
Configuring your requirement with following sequences
Step 1: Model Category (No dependency)
- The user selects the Model Category first.
Step 2: Make Model Dependent on Category
Limit the Model choices based on the selected Model Category..
- Configure the Model field dictionary.
- Set the Reference qual to advanced.
- Use this Reference Qualifier: cmdb_model_category=javascript:current.u_model_category (Replace u_model_category with your actual field name).
- Set Dependent field to u_model_category.
Step 3: Configure the Location field so that the available locations are filtered based on the selected Model.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @vodnalar26
You can achieve this requirement by using a combination of Reference Qualifiers, UI Policies, and Client Scripts.
Recommended approach:
1. Make the 'Model' field dependent on 'Model Category'
Configure a Reference Qualifier on the 'Model' field so it only shows models related to the selected category.
Example:
model_category=' + current.u_model_category
2. Prevent users from selecting 'Model' before 'Model Category'
Create a UI Policy or Client Script to make the 'Model' field read-only or hidden until 'Model Category' is selected.
Example:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue) {
g_form.setReadOnly('u_model', false);
}
else {
g_form.clearValue('u_model');
g_form.setReadOnly('u_model', true);
}
}3. Enable 'Location' only after 'Model' is selected
Similarly, use another UI Policy or Client Script to control the 'Location' field.
Example:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue) {
g_form.setReadOnly('u_location', false);
}
else {
g_form.clearValue('u_location');
g_form.setReadOnly('u_location', true);
}
}This approach provides a guided and user-friendly experience where users follow the required sequence
Model Category > Model > Location.
Hope this helps.
Regards,
VaniMadhuri