- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 02:24 AM - edited 04-04-2024 02:35 AM
Hi there community!
I have encountered this question while doing some random chat with my colleagues. How can we create a payload which will have all the data of an incident record in any script?
Kindly help me know whether this is possible and if yes, how 🙂
++ is there any OOB functionality in the tool which automatically creates payload of RITMs?
Regards,
Ritik
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 03:19 AM
Hello Ritik,
There is a script include available to convert a GlideRecord into a JSON object:
eg:
var current = new GlideRecord('incident');
current.get('a708c99ec3994618c736ca7dc00131ad');
var util = new global.GlideRecordUtil();
var hashmap = {};
util.populateFromGR(hashmap,current)
gs.info(hashmap);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 03:19 AM
Hello Ritik,
There is a script include available to convert a GlideRecord into a JSON object:
eg:
var current = new GlideRecord('incident');
current.get('a708c99ec3994618c736ca7dc00131ad');
var util = new global.GlideRecordUtil();
var hashmap = {};
util.populateFromGR(hashmap,current)
gs.info(hashmap);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 04:05 AM
Et Voila! That worked 🎆
hashmap is storing an object so I updated your script to:
gs.info(JSON.stringify(hashmap));
Thanks for the help 🙂