- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2015 07:32 AM
I'm brand new to ServiceNow and it's scripting engine and have been digging through the documentation that is available but am stuck on one issue. Is there a list of accessible objects or any way to generate a list?
For Example:
I'm building a list definition for use on a content page. The list is based on the "Change Request" table and I want to show the short description, planned start date, planned end date, and the first X characters of the body of the request.
I know that ${current.short_description.getDisplayValue()} will give me the title... but how do I find out any other objects that I can access in scripts short of guessing each object. Is there any way to generate a list of all accessible objects for a record?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2015 09:21 AM
Hi Robert,
You can access any of the fields on Change Request. If you want to know what those fields are, go to the Tables module, which should open the list view for the sys_db_object table:
Find the Change Request table in this list, and scroll down to the Columns:
You can access any of the columns using the same JEXL syntax:
${current.location.getDisplayValue()}
$$current.comments_and_work_notes}
${current.opened_at}
${current.priority}
...and so forth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2015 08:46 AM
Hi,
You can use getFields() method.
var fields = current.getFields();
// Enumerate GlideElements in the GlideRecord object that have values
gs.print('Enumerating over all fields with values:');
for (var i = 0; i < fields.size(); i++) {
var glideElement = fields.get(i);
if (glideElement.hasValue()) {
gs.print(glideElement.getName());
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2015 09:14 AM
Hi Robert,
In addition, you may find the below link helpful.
http://wiki.servicenow.com/?title=Scripting_for_Email_Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2015 09:21 AM
Hi Robert,
You can access any of the fields on Change Request. If you want to know what those fields are, go to the Tables module, which should open the list view for the sys_db_object table:
Find the Change Request table in this list, and scroll down to the Columns:
You can access any of the columns using the same JEXL syntax:
${current.location.getDisplayValue()}
$$current.comments_and_work_notes}
${current.opened_at}
${current.priority}
...and so forth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2015 09:58 AM
Thanks everyone... that's exactly what I was looking for.