- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2023 10:13 AM
Hi All,
I came across issue with parsing i have a JOSN format which need to be parsed. As new JSONParser() API deprecated in global cannot be used in scoped applications.can you suggest what is the alternate for this?
var inv = new GlideRecord('table_name');
inv.addQuery('number', SampleArray.arr[i].number);
while (inv.next()) {
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2023 11:02 AM
@sasi You can JSON API methods using global keyword in scoped app. Refer below document
Use below corrected code
var SampleArray = {
"arr": [{
'number': 'CM0213631'
}]
};
var jsonObject = global.JSON.stringify(SampleArray);
var parser = global.JSON.parse(jsonObject);
var arrayObject = parser.arr;
for (var i = 0; i < arrayObject.length; i++) {
var arrayElementObject = global.JSON.stringify(arrayObject[i]);
var arrayElement = global.JSON.parse(arrayElementObject);
var grObject = new GlideRecord('table_name');
grObject.addQuery('number', arrayElement.number);
grObject.query();
while (grObject.next()) {
gs.info("Testingscheduledjob2 ");
}
}
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2023 11:02 AM
@sasi You can JSON API methods using global keyword in scoped app. Refer below document
Use below corrected code
var SampleArray = {
"arr": [{
'number': 'CM0213631'
}]
};
var jsonObject = global.JSON.stringify(SampleArray);
var parser = global.JSON.parse(jsonObject);
var arrayObject = parser.arr;
for (var i = 0; i < arrayObject.length; i++) {
var arrayElementObject = global.JSON.stringify(arrayObject[i]);
var arrayElement = global.JSON.parse(arrayElementObject);
var grObject = new GlideRecord('table_name');
grObject.addQuery('number', arrayElement.number);
grObject.query();
while (grObject.next()) {
gs.info("Testingscheduledjob2 ");
}
}
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2023 08:04 PM
Thank you so much..it's working as expected