From 885041f1c61bdc35787cfebce495a0eb0ecfb07c Mon Sep 17 00:00:00 2001 From: pallipoina92 <33309804+pallipoina92@users.noreply.github.com> Date: Thu, 31 Oct 2024 23:15:45 +0530 Subject: [PATCH 1/2] Create Glide Record Encoded Query.js The purpose of this script is to find all active incidents in the ServiceNow platform that are categorized as either "software" or "hardware" using the Encoded Query. --- GlideRecord/Encoded Query/Glide Record Encoded Query.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 GlideRecord/Encoded Query/Glide Record Encoded Query.js diff --git a/GlideRecord/Encoded Query/Glide Record Encoded Query.js b/GlideRecord/Encoded Query/Glide Record Encoded Query.js new file mode 100644 index 0000000..53a7192 --- /dev/null +++ b/GlideRecord/Encoded Query/Glide Record Encoded Query.js @@ -0,0 +1,9 @@ +var grInc = new GlideRecord('incident'); +var strQuery = 'active=true'; +strQuery = strQuery + '^category=software'; +strQuery = strQuery + '^ORcategory=hardware'; +grInc.addEncodedQuery(strQuery); +grInc.query(); +while(grInc.next()){ +gs.print(grInc.number); +} From 97e79f5a4b7c20ded3175118e294e81d1de647af Mon Sep 17 00:00:00 2001 From: pallipoina92 <33309804+pallipoina92@users.noreply.github.com> Date: Thu, 31 Oct 2024 23:18:19 +0530 Subject: [PATCH 2/2] Create readme.md The purpose of this script is to find all active incidents in the ServiceNow platform that are categorized as either "software" or "hardware" using the Encoded Query. --- GlideRecord/Encoded Query/readme.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 GlideRecord/Encoded Query/readme.md diff --git a/GlideRecord/Encoded Query/readme.md b/GlideRecord/Encoded Query/readme.md new file mode 100644 index 0000000..880810d --- /dev/null +++ b/GlideRecord/Encoded Query/readme.md @@ -0,0 +1,11 @@ +**Create a GlideRecord Object:** +var grInc = new GlideRecord('incident'); + +**Initialize the Encoded Query String:** +var strQuery = 'active=true^category=software^ORcategory=hardware'; + +**Add the Encoded Query to the GlideRecord:** +grInc.addEncodedQuery(strQuery); + +**Execute the Query:** +grInc.query();