Readable Query from GlideRecord.getEncodedQuery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 06:39 PM
Hi All,
In my scoped app I have a logging system for debugging etc, that regularly outputs an encoded query to say "Found x number of records matching condition y" in combination with other things.
Is there a way to take arbitrary GlideRecord.getEncodedQuery and format it into the human-readable version?
I know you can use getDisplayValue on a conditions field, but this will not be stored in any field. I've tried hijacking the ATFStepDescriptionGenerator().getConditionDescription however this doesn't work, neither does the one that auto-generates PA Indicator descriptions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2019 12:16 AM
This also works, being mindful that the code can't be packaged in with your scoped app. It makes the application dependent on custom globally scoped code external to the application.
The example I have provided could be put into a Script Include and bundled in with the Scoped Application.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2019 12:25 AM
What paul said is correct. If you are planning to deploy your app on app store, then you cannot use this global script include. If its going to deploy on a production instance, then you can use it.
Paul, I tried your code in background script, but it did not give any output. you are initializing it in your code. Sould not there be an insert before to read the value?