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 default query for Sn record picker

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.

2 REPLIES 2

Community Alums
Not applicable

@Community Alums you can paste encoded query in default-query.

In your case, you can use default-query="'activate=true^nameSTARTWITHyour_text'".

Hope this will help you.

In the Server Side of the Widget:

 

data.encQuery = 'encoded query';

 

Then in SN Record Picker call the same as mentioned below:

 

<sn-record-picker

     field :

     table:

    default-query = 'c.data.encQuery'>

</ sn-record-picker>