Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**Dynamic Reference Qualifier with Filtering**
This Client Script provides a solution for dynamically updating the available options in a Reference Field based on the value selected in another field on the same form.

This technique is essential for ensuring data quality and improving the user experience (UX).

A typical use case is filtering the Assignment Group field to show only groups relevant to the selected Service, Category, or Location.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var controlledField = 'assignment_group';
var controllingField = 'u_service';
var serviceSysId = g_form.getValue(controllingField);
var encodedQuery = 'typeLIKEITIL^u_related_service=' + serviceSysId;
g_form.setQuery(controlledField, encodedQuery);
var currentGroupSysId = g_form.getValue(controlledField);
if (currentGroupSysId && oldValue !== '' && currentGroupSysId !== '') {
g_form.setValue(controlledField, '');
}
}
Loading