returning data from a glide list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2011 06:31 AM
If I have a glide list of locations how do I return the Site Code, City, and State in a mail message? I have not worked with arrays so I am not sure how to extract each location from the array so I can do a look up on each location. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2011 09:13 AM
Assign a glide list content to an array variable
Talks about assigning glide list content to an Array
http://wiki.service-now.com/index.php?title=Referencing_a_Glide_List_from_a_Script
Is about about referencing a Glide from a script
http://wiki.service-now.com/index.php?title=ArrayUtil
A potential helpful array utility
Hopefully that gives you a few places to start. Let me know if you're still stuck.
~Joe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2011 10:10 AM
I've got the part where I split the list, but how do I then return the data tied on each location I pulled out?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2011 10:36 AM
While this may not be exactly this was the only other thing I could find close to what you are looking at:
adding the list of CR approvers in email content
Feel free to post your code and/or screen shots any additional information you can provide is always helpful.
~Joe

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2011 11:15 AM
This should work in a mail script if your location field is 'u_locations'.
var list = current.u_locations.toString();
var array = list.split(',');
for(var i=0; i < array.length; i++){
var loc = new GlideRecord('cmn_location');
loc.get(array<i>);
template.print('Location name: ' + loc.name + '\n');
template.print('Location city: ' + loc.city + '\n');
template.print('Location state: ' + loc.state + '\n');
template.print('\n');
}