The easy way to encode JSON GlideRecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 08:09 PM - edited 11-09-2022 05:58 AM
Hi all
I sure that you see some troubleshooting when you find a way to encode GlideRecord to JSON string
And I have the easy way to do it with OOTB script include
var util= new global.GlideRecordUtil();
var grinc= new GlideRecord("incident");
grinc.get("your_sys_id");
var hashmap={};
util.populateFromGR(hashmap,grinc);//use this function to populate all fields to object hashmap and after that we will encode the hashmap object
gs.print(JSON.stringify(hashmap));
- 1,824 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 11:39 PM
Is this a question or you are willing to share some content in community?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2022 01:03 AM
I just share the content to community to people.
Well before the new UI community I can create a article but now I cannot create article so go to this and post it

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2022 01:14 AM
Thanks for sharing!
Thanks
Anil Lande