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.

Encoded query with or condition

gomathyshankar
Tera Contributor

Hi,

I want to write encoded query for 'GOTOnameLIKEfolder^ORshort_descriptionSTARTSWITHfolder 'The problem the 'folder'   is dynamic.It

obtained from the user.The code we are using is mentioned below.I want to add sc.addEncodedQuery('GOTOshort_descriptionSTARTSWITH'+data.q)

in or condition to the existing sc.addEncodedQuery('GOTOnameLIKE'+data.q); query.

data.q = input.q;

sc.addEncodedQuery('GOTOnameLIKE'+data.q);

1 ACCEPTED SOLUTION

snehabinani26
Tera Guru

Try using this.


var query = "GOTOnameLIKE"+data.q+"^ORshort_descriptionSTARTSWITH"+data.q;


sc.addEncodedQuery(query);


sc.query();



Hope this helps you.


View solution in original post

3 REPLIES 3

snehabinani26
Tera Guru

Try using this.


var query = "GOTOnameLIKE"+data.q+"^ORshort_descriptionSTARTSWITH"+data.q;


sc.addEncodedQuery(query);


sc.query();



Hope this helps you.


bubuprasadswain
Tera Guru

can you please try:


sc.addEncodedQuery('GOTOshort_description>=+data.q^GOTOnameLIKE+data.q');



Regards,


Bubuprasad


Venkateswarlu K
Mega Guru

HI Gomathyshankar Selvakumar


can u pls try   this


var gr=new GlideRecord('ur table name here');


gr.addEncodedQuery(short_descriptionSTARTSWITH+data.q^ORGOTOnameLIKE"+data.q);


gr.query();


while(gr.next()){


//Do some action here


}