The CreatorCon Call for Content is officially open! Get started here.

Client-side filter not applying to hr_service field due to OOB reference qualifier

manisnow122
Tera Contributor

Hi all,

 

I’m trying to dynamically filter the hr_service reference field based on the selected assignment group using a client-side onChange script with GlideAjax. The Script Include returns a valid encoded query like hr_criteria=..., and I’m using g_form.setFilter() to apply it.

 

However, the filter doesn’t apply — likely because the field uses the OOB Advanced reference qualifier.

 

I don’t want to modify the OOB Script Include. Is there a supported way to:

Apply both the filters ie., Advanced reference qualifier as well as the client script.

 

Thanks in advance!

1 ACCEPTED SOLUTION

YaswanthKurre
Tera Guru

Hi @manisnow122 ,

 

In ServiceNow, the ^ operator in a reference qualifier is used to concatenate conditions, not to call multiple Script Includes. So if you're trying to invoke two Script Includes in a reference qualifier using ^, that won't work directly.  The only option for you is to override a Script Include or create a new one and use it.

 

Mark this as helpful and correct if this helps you.

 

Thanks,

Yaswanth

 

View solution in original post

4 REPLIES 4

YaswanthKurre
Tera Guru

Hi @manisnow122 ,

 

Unfortunately, you cannot use g_form.setFilter() to override or combine with an existing Advanced Reference Qualifier. ServiceNow's out-of-the-box (OOB) functionality prioritizes the server-side Advanced Reference Qualifier, and the client-side g_form.setFilter() method is ignored when one is present.

 

The recommended and supported way to dynamically filter a reference field that already uses an Advanced Reference Qualifier is to modify the existing Script Include utils, if it is using 2 script include approach (utils and base) create a new one and reference this in your reference qualifier.

 

Modifying the Utils Script Include in ServiceNow is supported and considered safe during upgrades, as long as you do not change the protected base Script Include directly. Many out-of-the-box (OOB) Script Includes, especially in scoped applications like HR or ITSM, are designed with an extension pattern. The base Script Include (e.g., HR_FulfillmentUtilsBase) is protected and read-only, while a corresponding child Script Include (e.g., HR_FulfillmentUtils) is provided specifically for customization. To customize logic, you can safely copy a function from the base Script Include into the Utils Script Include and override it there. This approach preserves upgrade compatibility and follows best practices by extending functionality without altering core OOB code.

 

Mark this as helpful and correct if this answers your question.

 

Thanks,

Yaswanth

Hi @YaswanthKurre

Can i have two script include scripts and call them in the reference qualifier using ^ operator, because my requirement is only for a particular group and i dont want to modify the oob script.

YaswanthKurre
Tera Guru

Hi @manisnow122 ,

 

In ServiceNow, the ^ operator in a reference qualifier is used to concatenate conditions, not to call multiple Script Includes. So if you're trying to invoke two Script Includes in a reference qualifier using ^, that won't work directly.  The only option for you is to override a Script Include or create a new one and use it.

 

Mark this as helpful and correct if this helps you.

 

Thanks,

Yaswanth

 

Hi @YaswanthKurre ,

Thank you for the reply