How can I reach Embedded Lists from a GlideRecord Query?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 02:02 PM
Hi All -
I have a scripted web service for a static WSDL and need to reach some of the embedded lists on that form. I understand the challenges for this as they are not really related to that form. However, is there anyway possible that I can dot-walk or something? Would it be best to build my GlideRecord script from the parent table down?
Any insight is appreciated. I'm happy to clarify wherever needed.
oh and, this is on Fuji if that matters. Thanks in advance!
- Labels:
-
Integrations
-
Scoped App Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 04:26 PM
Embedded list is pretty much the same as a Related List but displayed differently. So if you want to get to the data in that list you will have to query the table that list comes from with the same query used to display it on the form you are talking about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 07:02 AM
Ok, so in my WSDL I'll need to make an additional GlideRecord call to the other table(s) for the embedded lists?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 07:08 AM
masha, Hi
something like this ..
var test = new GlideRecord("table");
test.orderBy('field');
test.query();
while(test.next()) {
var item = xmldoc.createElement("getRecords");
// move to inner element
xmldoc.setCurrent(item);
xmldoc.createElement('field1', test.sys_id);
xmldoc.createElement('field2', test.number.getDisplayValue());
var test2 = new GlideRecord("table_2");
test2.orderBy('whatever');
test2.query();
while(test.next()) {
var item = xmldoc.createElement("getRecords");
// move to inner element
xmldoc.setCurrent(item);
xmldoc.createElement('field1', test2.sys_id);
xmldoc.createElement('field2', test.number.getDisplayValue());

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 09:12 AM
If you want to be able to get the data from both tables in the same call I would suggest you build a Javascript object to hold your data, covert it to XML and returning it. Your GlideRecord call would look something like:
var test = new GlideRecord("table");
test.orderBy('field');
test.query();
while(test.next()) {
//get the values you need from the record.
...
//get embedded list values for this record
var embedded_list_item = new GlideRecord("embedded_list_table");
embedded_list_item.addQuery(<query to get the related records from the embedded list table>);
embedded_list_item.query();
while(embedded_list_item.next()) {
//get the values you need from the embedded list records
...
}
}