This document specifies Key ServiceNow OOB API references which can be used
|
Merges two arrays
|
new ArrayUtil().concat(array1,array2) |
|
Searches the array for the element. Returns true if the element exists in the array, otherwise returns false
|
new ArrayUtil().contains(array,searchobject) |
|
Converts an object to an array.
|
new ArrayUtil().convertArray(Object) |
|
Finds the differences between two or more arrays
|
new ArrayUtil().diff(array1,array2,array n) |
|
Returns an array from the object.
|
new ArrayUtil().ensureArray(Object) |
|
Searches the array for the element. Returns the element index if found, -1 otherwise.
|
new ArrayUtil().indexOf(array1, seachelement) |
|
Finds the elements common in all arrays.
|
new ArrayUtil().intersect(Array a, Array b) |
|
Merges two or more arrays (common element is addded once)
|
new ArrayUtil().union(Array a, Array b) |
|
Removes duplicate items from an array.
|
new ArrayUtil().unique(Array a) |
var arUtil = new ArrayUtil();arUtil.unique(array1);
|
Determine which business services are affected by a specific CI.
|
new CIUtils().servicesAffectedByCI(ci_sys_id); |
|
Determine which business services are affected by a task.
|
new CIUtils().servicesAffectedByTask(taskgliderecord) |
var CIUtil = new CIUtils();var bsaffected = CIUtil.servicesAffectedByCI(ci_sys_id);
|
Compares a specified filter to the contents of a specified GlideRecord.
|
GlideFilter.checkRecord(glideRecord, "filterconditions",matchparameter); |
|
Checks to see if a table exists.
|
new TableUtils("TABLENAME").tableExists(); |
|
Drops a database table. (use with caution)
|
new TableUtils().drop("TABLENAME"); |
|
Drops a database table and cleans up references to the table.
|
new TableUtils().dropAndClean("TABLENAME"); |
|
Drops a database table, all of it's extended tables, and cleans up references to the tables.
|
new TableUtils().dropTableAndExtensions("TABLENAME"); |
|
Returns the base table name from which the table was extended.
|
new TableUtils("tablename").getAbsoluteBase(); |
|
Returns the list of tables that extend a table, includes the base table in array
|
new TableUtils("tablename").getAllExtensions(); |
|
Returns a list of all classes participating in the hierarchy of the specified table.
|
new TableUtils("tablename").getHierarchy(); |
|
Returns the table hierarchy.
|
new TableUtils("tablename").getTables(); |
|
Returnss a list of tables that extend a table.
|
new TableUtils("tablename").getTableExtensions(); |
|
Determines if a table has been extended.
|
new TableUtils("tablename").hasExtensions(); |
|
Determines if a table is a base class, meaning it has no parents and has extensions.
|
new TableUtils("tablename").isBaseClass(); |
|
Determines if the table has no parents and no extensions.
|
new TableUtils("tablename").isSoloClass(); |
|
Copies attachments from the source record to the target record.
|
new GlideSysAttachment().copy(String sourceTable, String sourceID, String targetTable, String targetID) |
|
Deletes the specified attachment.
|
new GlideSysAttachment().deleteAttachment(attachmentsysID) |
|
Returns a GlideRecord containing the matching attachment metadata such as name, type, or size.
|
new GlideSysAttachment().getAttachments('<table_name>', '<record_sys_id>'); |
|
Returns the attachment content as a string.
|
new GlideSysAttachment().getContent(GlideRecord sysAttachment) |
|
Returns the attachment content as a string with base64 encoding.
|
new GlideSysAttachment().getContentBase64( GlideRecord sysAttachment) |
|
Inserts an attachment for the specified record using base64 encoded content.
|
new GlideSysAttachment().writeBase64( GlideRecord gr, String fileName, String contentType, String content_base64Encoded) |
|
Repair the task SLAs associated with the passed-in filter and source table.
|
new SLARepair().repairByFilter('filter', 'tablename'); |
|
Repair the task SLAs associated with the passed in GlideRecord.
|
new SLARepair().repairByGlideRecord(glideRecord) |
|
Repair the task SLAs associated with the passed in sys_id and source table.
|
new SLARepair().repairBySysId('sysId', 'tablename'); |
|
Enables or disables auditing when running a repair.*
|
new SLARepair().setAuditEnabled(true); |
|
Enables or disables running a workflow for each of the Task SLA records being repaired.
|
new SLARepair().setRunWorkflow(false) |
|
Validates the repair request.
|
new SLARepair().setValidateOnly(true); |
|
Adds the address to either the cc or bcc list.
|
email.addAddress('cc/bcc', 'emailaddress1','emailaddress2'); |
|
Returns the email's subject line.
|
email.getSubject() |
|
Returns the email's watermark.
|
email.getWatermark() |
|
Sets the body of the email.
|
email.setBody('bodytext'); |
|
Sets the sender's address.
|
`email.setFrom('emailaddress');
|
|
Sets the reply to address.
|
email.setReplyTo('emailaddress'); |
|
Sets the email's subject line.
|
email.setSubject('emailaddress'); |
|
Sets a session client value that can be retrieved with getClientData().
|
gs.getSession().putClientData('paramname', 'paramvalue'); |
|
Determines if the current user is currently logged in.
|
'gs.getSession().isLoggedIn()'
|
|
Determines if the current session is interactive.
|
'gs.getSession().isInteractive()'
|
|
Gets the name of the session's time zone.
|
'gs.getSession().getTimeZoneName()'
|
|
Gets a list of roles for the current user.
|
'gs.getSession().getRoles()'
|
|
Gets the session's language code.
|
'gs.getSession().getLanguage()'
|
|
Returns a session client value previously set with putClientData().
|
gs.getSession().getClientData('paramname'); |
|
Clears a session client value previously set with putClientData().
|
gs.getSession().clearClientData('paramname'); |
var session = gs.getSession();session.putClientData('cheatsheet', 'OOBAPI');
|
Adds the request for a catalog item to the current cart.
|
new sn_sc.CartJS().addToCart(request); |
|
Performs the cart checkout. If the two-step checkout is enabled, returns the order summary. If the two-step checkout is disabled, the cart is submitted and details of the generated request are returned.
|
new sn_sc.CartJS().checkoutCart(); |
|
Deletes the current cart.
|
new sn_sc.CartJS().empty(); |
|
Returns the cart id of the current cart.
|
new sn_sc.CartJS().getCartID(); |
|
Returns the GlideRecord for the cart item (sc_cart_item) in the current cart.
|
new sn_sc.CartJS().getCartItems(); |
|
Gets the sys_id from the sys_user record of the user for whom the cart is requested.
|
new sn_sc.CartJS().getRequestedFor(); |
|
Orders a single item.
|
new sn_sc.CartJS().orderNow(request); |
|
Specifies if the current user has the required role to edit the Request for field.
|
new sn_sc.CartJS().canViewRF(); |
|
Sets the sys_id in the sys_user record of the user for whom the cart is requested.
|
new sn_sc.CartJS().setRequestedFor(sysid) |
var item ={'sysparm_id': '0d08837237153000158bbfc8bcbe5d02', // Catalog item sys_id'sysparm_quantity': '1','variables':{ // Pass the catalog item variables'carrier': 'at_and_t_mobility','data_plan': '500MB','duration': 'eighteen_months','color': 'slate','storage': 'sixtyfour' }};
|
Prints the string to the email body.
|
template.print("Incident number - " + current.number + "\n"); |
|
Adds non-breaking spaces to the email body.
|
template.space(4); |
|
Returns the GlideLocale object.
|
GlideLocale.get() |
|
Returns the decimal separator.
|
var locale = GlideLocale.get(); var dseperatr = locate.getDecimalSeparator() |
|
Returns the grouping separator.
|
var locale = GlideLocale.get();var groupingSeparator = locale.getGroupingSeparator(); |
|
Returns a GlideRecord instance positioned to the given CI sys_id, and of the right class (table).
|
new GlideRecordUtil().getCIGR("cisysid"); |
|
Returns a list of all the fields in the specified GlideRecord.
|
new GlideRecordUtil().getFields(gliderecordobject) |
|
Returns a GlideRecord instance for the given table, positioned to the given sys_id, and of the right class (table).
|
new GlideRecordUtil().getGR("table", "sysID"); |
|
Returns a Java ArrayList of the ancestors of the given table name.
|
new GlideRecordUtil().getTables("tablename") |
|
Sets the fields in the specified GlideRecord with the field values contained in the specified hashmap, unless that field name is in the ignore hashmap.*
|
var gr = new GlideRecordUtil().getGR("table", "sysid"); var obj = {"fieldname": "fieldvalue"}; var ignore = {"sys_created_by": true}; new GlideRecordUtil().mergeToGR(obj, gr, ignore); gr.update(); |
|
Populates the given hashmap from the given GlideRecord instance. Each field in the GlideRecord becomes a property in the hashmap.( returns field/value pairs from the GlideRecord)
|
var objectToPopulate = {}; var gr = new GlideRecordUtil().getGR("table", "sysid"); var ignore = {"sys_created_on": true, "sys_updated_by": true}; new GlideRecordUtil().populateFromGR(objectToPopulate, gr, ignore); |
|
Adds a new schedule segment to the current schedule.
|
new GlideSchedule().add(startDate, duration) |
|
Determines the elapsed time in the schedule between two date time values using the timezone of the schedule or, if that is not specified, the timezone of the session.
|
var schedule = new GlideSchedule();schedule.load('schedulesysid');var duration = schedule.duration(startDate, endDate); |
|
Retrieves the schedule name.
|
new GlideSchedule(sys_id).getName() |
|
Determines if the given datetime is within the current schedule.
|
new GlideSchedule("schedulesysid").isInSchedule(date); |
|
Determines if the current schedule is valid. A schedule is valid if it has at least one schedule span.
|
new GlideSchedule("schedulesysid").isValid(); |
|
Sets the timezone for the current schedule.
|
var schedule = new GlideSchedule(); schedule.setTimeZone('US/Pacific'); |
|
Determines how much time (in milliseconds) until start time of the next schedule item.
|
new GlideSchedule('schedulesysID', 'timezone').whenNext(startDate) |
|
Cancels a paused or running flow, subflow, or action.
|
sn_fd.FlowAPI.startFlow('flowname', inputs); |
|
Run an action from a server-side script synchronously.
|
sn_fd.FlowAPI.executeAction('flowname', inputs); |
|
Run an action from a server-side script synchronously from the current user session without creating execution details or other related records
|
sn_fd.FlowAPI.executeActionQuick('flowname', inputs); |
|
Runs a Data Stream action synchronously from a server-side script and returns a ScriptableDataStream object.
|
sn_fd.FlowAPI.executeDataStreamAction('datastream_name',input,timeout); |
|
Run a flow from a server-side script synchronously.
|
sn_fd.FlowAPI.executeFlow('flowname', inputs,timeout); |
|
Run a flow, subflow, or action from a server-side script synchronously or asynchronously without creating execution details or other related records.
|
sn_fd.FlowAPI.executeFlowQuick('flowname', inputs); |
|
Run an subflow from a server-side script synchronously.
|
var results = sn_fd.FlowAPI.executeSubflow('flowname', inputs); |
|
Run a subflow from a server-side script synchronously from the current user session without creating execution details or other related records
|
var results = sn_fd.FlowAPI.executeSubflowQuick('flowname', inputs); |
|
Build password2 values inside a script step.
|
var encrypteddata=sn_fd.GlideActionUtil.setEncryptedOutput(Val); |
|
Run an action from a server-side script asynchronously.
|
sn_fd.FlowAPI.startAction('flowname', inputs); |
|
Run an action from a server-side script asynchronously without creating execution details
|
sn_fd.FlowAPI.startActionQuick('flowname', inputs); |
|
Run a flow from a server-side script.
|
sn_fd.FlowAPI.startFlow('flowname', inputs); |
|
Run a flow from a server-side script asynchronously without creating execution details
|
sn_fd.FlowAPI.startFlowQuick('flowname', inputs); |
|
Run a subflow from a server-side script.
|
sn_fd.FlowAPI.startSubflow('flowname', inputs); |
|
Run a subflow from a server-side script asynchronously without creating execution details
|
sn_fd.FlowAPI.startSubflowQuick('flowname', inputs); |
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.