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.

Modify sn-record-picker default query

Community Alums
Not applicable

Hello Experts,

 

I want to modify the default query for the below script , i want to add the below mentioned conditions

Condition : if a user is active and name starts with

 

<sn-record-picker id="delegate" field="c.delegate" table="'sys_user'" default-query="'active=true'" display-field="'name'" display-fields="'email'" value-field="'sys_id'" search-fields="'name'" page-size="100" translate="no"></sn-record-picker>

right now default query runs checks for if the user is active and 'name contains' instead of name contains i want to check for "name starts" with.

 

Please help.

1 REPLY 1

ICaTonyBalde
Tera Expert

Hello,
Simply add the condition to your query.
The query below filters records where the active field is true and the name field starts with the letter "C", and then it orders the results alphabetically by name.
Replace "C" with the desired condition.

 

"'default-query="'active=true^nameSTARTSWITHC^ORDERBYname'"