ServiceNow Adapter Actions
Define a connection to a ServiceNow Server.
Property | Value | Description |
---|---|---|
url* | text, expression, variable | the Base URL of the ServiceNow web service |
username* | text, expression, variable | Username for authentication to the ServiceNow web service |
password* | password, string, expression, variable | Password for authentication to the ServiceNow web service |
options | expression, variable | A record or JavaScript object with a field for each additional option. Currently defined fields are connectTimeout and socketTime which require a numeric value from 1 to 2147483647 (0x7FFFFFFF) that represents the number of milliseconds for the timeout, and 0 representing no timeout. |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
Global.snUrl = "https://sandbox.service-now.com" Global.snUser = "admin" Global.snPwd = "admin" session = defineServiceNowConnection(Global.snUrl, Global.snUser, Global.snPwd)
Deletes the record in ServiceNow. Returns a success boolean.
Property | Value | Description |
---|---|---|
connection* | expression, variable | the ServiceNow connection definition |
objectType* | text, expression, variable | The ServiceNow object type |
id* | text, expression, variable | The sys_id of the ServiceNow record to delete. |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
users = getServiceNowRecords(session, "sys_user", "user_name=joh.doe, 1) if(users.length) { result = deleteServiceNowRecord(session, "sys_user", users[0][\'sys_id\']) }
Gets a given ServiceNow Record.
Property | Value | Description |
---|---|---|
connection* | expression, variable | the ServiceNow connection definition |
objectType* | text, expression, variable | The ServiceNow object type |
id* | text, expression, variable | The sys_id of the ServiceNow record. |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
user = getServiceNowRecord(session, "02826bf03710200044e0bfc8bcbe5d55")
Get All ServiceNow Records.
Property | Value | Description |
---|---|---|
connection* | expression, variable | the ServiceNow connection definition |
objectType* | text, expression, variable | The ServiceNow object type |
filter | text, expression, variable | The filter used to limit results. Can either be an encoded query as specified by ServiceNow, or a Record example object. |
limit | expression, variable | The maximum number of records to return. Defaults to all objects. |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
users = getServiceNowRecords(sessionServiceNow, "sys_user", "user_name=john.doe", 1)
Open a ServiceNow Record Iterator.
Property | Value | Description |
---|---|---|
connection* | expression, variable | the ServiceNow connection definition |
objectType* | text, expression, variable | The ServiceNow object type |
filter | text, expression, variable | The filter used to limit results. Can either be an encoded query as specified by ServiceNow, or a Record example object. |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
it = openServiceNowRecordIterator(sessionServiceNow, "sys_user") forEach(user, it) { # do something with user } close(it)
Creates or updates the record in ServiceNow. Returns the id of the object.
Property | Value | Description |
---|---|---|
connection* | expression, variable | the ServiceNow connection definition |
objectType* | text, expression, variable | The ServiceNow object type |
record* | text, expression, variable | A Record object containing the fields you want to save. If 'sys_id' is set, an update will be performed, otherwise a create will be performed. |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
userTemplate = createRecord(true) setRecordFieldValue(userTemplate, "user_name", "john.doe") setRecordFieldValue(userTemplate, "first_name", "John") setRecordFieldValue(userTemplate, "user_name", "john.doe") setRecordFieldValue(userTemplate, "user_name", "john.doe") user = saveServiceNowRecord(sessionServiceNow, "sys_user", userTemplate)