- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 07:25 AM
Hi all,
I am storing the Array in below format. I need Line Id value from each object.
[
{'Quantity': '4','Parent':'OR00001','Sku':'Test1','Line Id':'3.00'},
{'Quantity': '5','Parent': 'OR00001','Sku': 'Test2','Line Id': '2.00'}
]
please help how to get the Line Id details from above array.
Thanks,
Pavan
Solved! Go to Solution.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 07:30 AM
Hi,
this works well
var obj = [
{'Quantity': '4','Parent':'OR00001','Sku':'Test1','Line Id':'3.00'},
{'Quantity': '5','Parent': 'OR00001','Sku': 'Test2','Line Id': '2.00'}
];
var arr = [];
for(var i=0;i<obj.length;i++)
arr.push(obj[i]['Line Id'].toString());
gs.info(arr);
Output:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 07:30 AM
Hi,
this works well
var obj = [
{'Quantity': '4','Parent':'OR00001','Sku':'Test1','Line Id':'3.00'},
{'Quantity': '5','Parent': 'OR00001','Sku': 'Test2','Line Id': '2.00'}
];
var arr = [];
for(var i=0;i<obj.length;i++)
arr.push(obj[i]['Line Id'].toString());
gs.info(arr);
Output:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 07:31 AM
Hi,
You can try this in background to see if you like it:
var array = [
{'Quantity': '4','Parent':'OR00001','Sku':'Test1','Line Id':'3.00'},
{'Quantity': '5','Parent': 'OR00001','Sku': 'Test2','Line Id': '2.00'}
];
for (var i=0;i<array.length;i++) {
gs.info(array[i]['Line Id']);
}
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!