Client side and Server side API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 02:00 AM
Could you please explain all the below APIs with example.
Glide Form , Glide user , Glide Ajax , Glide List , Glide window
Glide Aggregate , Glide Record Secure , Glide Date Time , Glide element ,Glide system and glide query
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 12:42 PM - edited 10-04-2024 12:43 PM
ServiceNow provides good documentation on their API's, usage, and examples.
I would suggesting reviewing their docs first, then post specific questions per your requirements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2024 03:40 AM
Hi Hanumesh,
Please find Glide classes with examples.
Regards,
Nikhil Bajaj
Regards,
Nikhil Bajaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2024 10:20 PM
Hi @hanumesh
Hope this explanation is useful to you question,
Glide Form
The GlideForm API provides methods for working with forms in ServiceNow. It allows you to create, update, and manipulate forms programmatically.
Example:
var form = new GlideForm('incident');
form.setValue('short_description', 'Test incident');
form.insert();
Glide User
The GlideUser API provides methods for working with user objects in ServiceNow. It allows you to create, update, and manipulate user records programmatically.
Example :
var user = new GlideUser (); // Create a new user object
user.setUserName('john.doe'); // Set the username
user.setFirstName('John'); // Set the first name
user.setLastName('Doe'); // Set the last name
user.insert(); // Insert the new user
Glide Ajax
The GlideAjax API provides methods for making asynchronous requests to the server from the client-side. It allows you to execute server-side scripts and retrieve data without refreshing the page.
Example :
var ga = new GlideAjax('MyAjaxScript'); // Create a new GlideAjax object
ga.addParam('sysparm_name', 'myParameter'); // Add a parameter to the request
ga.getXML(); // Make the asynchronous request and retrieve the response as XML
Glide List
The GlideList API provides methods for working with lists of records in ServiceNow. It allows you to create, update, and manipulate lists programmatically.
Example:
var list = new GlideList('incident'); // Create a new list object for the incident table
list.addQuery('priority', '1'); // Add a query to the list
list.orderBy('sys_created_on'); // Order the list by creation date
var records = list.getRecords(); // Retrieve the list of records
Glide Window
The GlideWindow API provides methods for working with windows and dialogs in ServiceNow. It allows you to create, update, and manipulate windows programmatically.
Example:
var window = new GlideWindow('incident'); // Create a new window object for the incident table
window.setTitle('My Incident Window'); // Set the window title
window.setModal(true); // Make the window modal
window.show(); // Show the window
Glide Aggregate
The GlideAggregate API provides methods for performing aggregate operations on records in ServiceNow. It allows you to perform calculations such as sum, average, and count on a set of records.
Example:
var aggregate = new GlideAggregate('incident'); // Create a new aggregate object for the incident table
aggregate.addAggregate('COUNT', 'sys_id'); // Add a count aggregate
aggregate.groupBy('category'); // Group the results by category
var results = aggregate.getAggregate(); // Retrieve the aggregate results
Glide Record Secure
The GlideRecordSecure API provides methods for working with secure records in ServiceNow. It allows you to create, update, and manipulate secure records programmatically.
Example:
var secureRecord = new GlideRecordSecure('incident'); // Create a new secure record object for the incident table
secureRecord.initialize(); // Initialize the secure record
secureRecord.setValue('short_description', 'Test incident'); // Set the short description field
secureRecord.insert(); // Insert the new secure record
Glide Date Time
The GlideDateTime API provides methods for working with dates and times in ServiceNow. It allows you to perform date and time calculations and conversions programmatically.
Example:
var dateTime = new GlideDateTime(); // Create a new date time object
dateTime.setDisplayValue('2022-01-01 12:00:00'); // Set the display value
var unixTime = dateTime.getUnixTime(); // Get the Unix time
Glide Element
The GlideElement API provides methods for working with form elements in ServiceNow. It allows you to create, update, and manipulate form elements programmatically.
Example:
var element = new GlideElement('incident', 'short_description'); // Create a new element object for the short description field
element.setLabel('My Short Description'); // Set the element label
element.setMandatory(true); // Make the element mandatory
Glide System
The GlideSystem API provides methods for working with system-level objects and properties in ServiceNow. It allows you to access and manipulate system properties and objects programmatically.
Example:
var system = new GlideSystem(); // Create a new system object
var property = system.getProperty('glide.ui.policy'); // Get a system property
Glide Query
The GlideQuery API provides methods for working with queries in ServiceNow. It allows you to create, update, and manipulate queries programmatically.
Example:
var query = new GlideQuery('incident'); // Create a new query object for the incident table
query.addCondition('priority', '1'); // Add a condition to the query
query.orderBy('sys_created_on'); // Order the query by creation date
var records = query.getRecords(); // Retrieve the query results
Regards,
Mule Syam Prasanna,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @hanumesh ,
If my answer helped you, please mark it- solution accepted.
Regards,
Nikhil Bajaj
Regards,
Nikhil Bajaj