Floe::ServiceNow

ServiceNow API integration for Floe workflow engine. This gem provides a Runner and Methods classes that inherit from Floe::BuiltinRunner::Runner and Floe::BuiltinRunner::Methods to enable ServiceNow operations within Floe workflows.

Installation

Add this line to your application's Gemfile:

gem 'floe-servicenow'

And then execute:

bundle install

Or install it yourself as:

gem install floe-servicenow

API Classes

Configuration

Authentication

ServiceNow operations support two authentication methods:

Basic Authentication

{
  "username": "your-username",
  "password": "your-password"
}

OAuth Bearer Token

{
  "access_token": "your-oauth-access-token",
  "client_id": "your-client-id",
  "client_secret": "your-client-secret",
  "refresh_token": "your-refresh-token"
}

Security Note: Never hardcode credentials in your workflow definitions. Use Floe's secrets management features.

OAuth Token Acquisition

Use the servicenow://oauth/token endpoint to obtain OAuth access tokens. See the OAuth API Methods section for details.

Usage

Resource URI Format

ServiceNow operations use the servicenow:// URI scheme with API prefix:

servicenow://<api_name>/<method_name>

For example:

  • servicenow://table/list_tables - List all tables using Table API

Example Workflows

Complete workflow examples demonstrating API usage can be found in the examples/ directory:

  • examples/cmdb.asl - Demonstrates CMDB API operations including CI management and relationships
  • examples/incident.asl - Demonstrates Incident API operations (create, resolve, close)
  • examples/oauth.asl - Demonstrates OAuth authentication with both password and refresh_token grant types
  • examples/service_catalog.asl - Demonstrates Service Catalog API operations (browse catalogs, order items, track requests)
  • examples/table.asl - Demonstrates all Table API CRUD operations in a single workflow

Available Methods

OAuth API Methods

See OAuth API documentation for authentication methods.

Method Description
Get OAuth Token Obtain OAuth access tokens using password or refresh_token grant types

Table API Methods

See Table API documentation for CRUD operations on ServiceNow tables.

Method Description
List Tables List all sys_db_object tables
Query Records Retrieve multiple records with filtering
Get Record Retrieve a single record by sys_id
Create Record Create a new record in a table
Update Record Replace all fields of a record (PUT)
Patch Record Update specific fields of a record (PATCH)
Delete Record Delete a record from a table

CMDB API Methods

See CMDB API documentation for Configuration Management Database operations.

Method Description
Get Configuration Item Retrieve a single CI by sys_id
Query Configuration Items Query multiple CIs with filtering
Create Configuration Item Create a new CI
Update Configuration Item Update an existing CI
Delete Configuration Item Delete a CI
Get CI Relationships Retrieve CI and its relationships
Create CI Relationship Create a relationship between two CIs
Get CI Classes Retrieve available CMDB CI classes

Incident API Methods

See Incident API documentation for incident management operations.

Method Description
Create Incident Create a new incident
Get Incident Retrieve a single incident by sys_id
Update Incident Update an existing incident
Resolve Incident Resolve an incident (state 6)
Close Incident Close an incident (state 7)
Query Incidents Query multiple incidents with filtering

Service Catalog API Methods

See Service Catalog API documentation for catalog browsing and ordering operations.

Method Description
Submit Catalog Item Submit a catalog item order directly
Get Request Retrieve details of a service catalog request
Get Requested Item Retrieve summary of a requested catalog item
Get Catalogs Retrieve all available service catalogs
Get Catalog Retrieve details of a specific catalog
Get Categories Retrieve all available catalog categories
Get Category Retrieve details of a specific category
Get Items Retrieve all available catalog items
Get Item Retrieve details of a specific catalog item
Search Items Search for catalog items by search term
Get Cart Retrieve current shopping cart contents
Add to Cart Add a catalog item to the shopping cart
Update Cart Item Update a catalog item in the shopping cart
Remove from Cart Remove a catalog item from the shopping cart
Empty Cart Remove all items from the shopping cart
Checkout Cart Checkout the shopping cart
Submit Order Submit the shopping cart as an order

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ManageIQ/floe-servicenow.

Development Guidelines

  1. Follow existing code patterns from Floe::BuiltinRunner
  2. Add tests for all new methods
  3. Update documentation for new features
  4. Ensure all tests pass before submitting PR

License

The gem is available as open source under the terms of the Apache-2.0 License.

  • Floe - Workflow engine for Ruby
  • ManageIQ - Open-source management platform

Support

For issues and questions: