Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Using "Contains" in Reference Qualifier for Custom CSM portal without changing global property.

hemanaidu85
Giga Contributor

Hi everyone, 

I'm working on a custom CSM portal where i have a variable with reference qualifier that currently uses "starts with" for searching. The requirement is to switch this to contain to make searching easier and to provide better results for users.

The solution i found so far is to change the global system property '"glide.ui.ref_ac.startswith" is set to false. But im concerned that modifying this property will impact the entire platform.

 

 Does anyone have any suggestions or best practices on how to implement "contains" search for reference qual without changing the global system property.

 

Thanks in advance for your help!

1 REPLY 1

Ricardo26
Tera Guru

 

Hello,

There is a way, but it's very complex.

First, you need to clone the ServiceNow Angular directive.

You can find it here: yourintance.com/scripts/sn/common/controls/directive.snRecordPicker.js
How to create a directive: Exercise: Create a Directive | ServiceNow Developer

 

Second, you need to change the original code to always use "contains" instead of "startsWith".

 

Third, create a widget and configure your directive in the HTML code.

 

Next, in your catalog item, you'll need to create a new variable of type "custom" and select the widget you created earlier.

 

If this is helpful, please mark it as helpful or accept the solution.