Skip to main content

snow-delete

info

This promotion step is only available in Kargo on the Akuity Platform, versions v1.9.0 and above.

This page is for snow-delete step. You can delete a ServiceNow record using this step. Check below for other ServiceNow promotion steps.

ServiceNow integration for kargo is a group of promotion steps:

  1. snow-create
  2. snow-update
  3. snow-delete
  4. snow-query-for-records
  5. snow-wait-for-condition

These steps provide a comprehensive integration with ServiceNow, allowing you to create, update, delete, query for records, and track promotion workflows. This is particularly useful for maintaining traceability between your promotion processes and project management activities.

All the steps above support different record types in ServiceNow including managing Change Requests, Incidents, Problems etc.,. This integration also provides condition tracking through snow-wait-for-condition, making it a powerful tool for promotion workflows that require coordination with project management systems.

Using the API

Most of the time you cannot use the field labels seen in the ServiceNow UI as REST API keys. Use the field’s column_name (e.g., short_description).

For example, if you want to set the value for the “Short description” field:

You can't use Short description in the REST API. You need to use short_description as the key and set the value via REST API parameters. To find the correct key for a field, right-click on the field and click Configure Dictionary:

column_name is the key:

To see choices available for a particular field e.g., State, right click on the field and click on Show Choice List to see the available choices for use in the steps:

For example New is -1 and Scheduled is -2

Configuration

Credentials

All ServiceNow operations require proper authentication credentials stored in a Kubernetes Secret.

NameTypeRequiredDescription
credentials.secretNamestringYName of the Secret containing the ServiceNow credentials in the project namespace.
credentials.typestringYType of ServiceNow credentials to use for authentication (either api-token or basic).

For credentials.type: api-token the referenced Secret should contain the following keys:

  • apiToken: ServiceNow API Token (see this blog post for how to create an API token in ServiceNow).
  • instanceURL: Your ServiceNow instance URL.

For credentials.type: basic the referenced Secret should contain the following keys:

  • username: Username of the ServiceNow user (you may want to create a user specifically for this integration).
  • password: Password of the ServiceNow user (for how to set the password for a user, see this).
  • instanceURL: Your ServiceNow instance URL.

Record

NameTypeRequiredDescription
tableNamestringYTable name (e.g., incident, problem, change_request).
ticketIdstringYRecord sys_id.
templateobjectNUse Change Management API for Change Requests; otherwise omit.
template.typestringY/NRequired if template is specified (standard, emergency, normal).

Output

This step does not produce output.

Examples

This example deletes a Change Request using the Change Management API (notice how template is specified):

steps:
- as: snowdelete
config:
credentials:
secretName: snow-creds
type: api-token
tableName: change_request
template:
type: standard
ticketId: d457fbac6112287007379b57c6b2e60 # example
uses: snow-delete

This example deletes an Incident using the Table API (notice how the template field is omitted):

steps:
- as: snowdelete
config:
credentials:
secretName: snow-creds
type: api-token
tableName: incident
ticketId: d457fbac6112287007379b57c6b2e60 # example
uses: snow-delete

This example deletes a Change Request using the Table API (notice how the template field is omitted):

steps:
- as: snowdelete
config:
credentials:
secretName: snow-creds
type: api-token
tableName: change_request
ticketId: d457fbac6112287007379b57c6b2e60 # example
uses: snow-delete

Different E2E Workflows

These examples demonstrate the different steps supported for ServiceNow integration.

Change API Workflow

  - as: snowcreate
config:
credentials:
secretName: snow-creds
type: api-token
parameters:
impact: "3"
short_description: Deploy to ${{ ctx.stage }} complete for ${{ vars.imageRepo
}}:${{ imageFrom(vars.imageRepo).Tag }}
urgency: "3"
tableName: change_request
template:
templateId: ed89b72c83c172104517e470ceaad30a
type: standard
uses: snow-create
- as: snowquery
config:
credentials:
namespace: kargo-demo
secretName: snow-creds
type: api-token
query:
number: ${{ task.outputs.snowcreate.number }}
tableName: change_request
uses: snow-query-records
- as: snowupdate
config:
credentials:
secretName: snow-creds
type: api-token
parameters:
short_description: Update deployment for ${{ vars.imageRepo }}:${{
imageFrom(vars.imageRepo).Tag }} to resolved
tableName: change_request
template:
type: standard
ticketId: ${{ task.outputs.snowquery.sys_id }}
uses: snow-update
- as: snow-wait-for-condition
config:
condition: state=-2
credentials:
namespace: kargo-demo
secretName: snow-creds
type: api-token
tableName: change_request
ticketId: ${{ task.outputs.snowquery.sys_id }}
uses: snow-wait-for-condition
- as: snowdelete
config:
credentials:
secretName: snow-creds
type: api-token
tableName: change_request
template:
type: standard
ticketId: ${{ task.outputs.snowquery.sys_id }}
uses: snow-delete

Table API Workflow

  - as: snowcreate
config:
credentials:
secretName: snow-creds
type: api-token
parameters:
impact: "3"
short_description: Deploy to ${{ ctx.stage }} complete for ${{ vars.imageRepo }}:${{ imageFrom(vars.imageRepo).Tag }}
urgency: "3"
tableName: incident
uses: snow-create
- as: snowquery
config:
credentials:
namespace: kargo-demo
secretName: snow-creds
type: api-token
query:
number: ${{ task.outputs.snowcreate.number }}
tableName: incident
uses: snow-query-records
- config:
ticketId: ${{ task.outputs.snowquery.sys_id }}
credentials:
secretName: snow-creds
type: api-token
parameters:
short_description: Update deployment for ${{ vars.imageRepo }}:${{ imageFrom(vars.imageRepo).Tag }} to resolved
tableName: incident
uses: snow-update
- as: snow-wait-for-condition
config:
condition: state=6
credentials:
namespace: kargo-demo
secretName: snow-creds
type: api-token
tableName: incident
ticketId: ${{ task.outputs.snowquery.sys_id }}
uses: snow-wait-for-condition
- as: snowdelete
config:
credentials:
secretName: snow-creds
type: api-token
tableName: incident
ticketId: ${{ task.outputs.snowquery.sys_id }}
uses: snow-delete

Here's a Table API workflow with Change Request:

  - as: snowcreate
config:
credentials:
secretName: snow-creds
type: api-token
parameters:
impact: "3"
short_description: Deploy to ${{ ctx.stage }} complete for ${{ vars.imageRepo
}}:${{ imageFrom(vars.imageRepo).Tag }}
urgency: "3"
tableName: change_request
uses: snow-create
- as: snowquery
config:
credentials:
namespace: kargo-demo
secretName: snow-creds
type: api-token
query:
number: ${{ task.outputs.snowcreate.number }}
tableName: change_request
uses: snow-query-records
- as: snowupdate
config:
credentials:
secretName: snow-creds
type: api-token
parameters:
short_description: Update deployment incident for ${{ vars.imageRepo }}:${{
imageFrom(vars.imageRepo).Tag }} to resolved
tableName: change_request
ticketId: ${{ task.outputs.snowquery.sys_id }}
uses: snow-update
- as: snow-wait-for-condition
config:
condition: state=-2
credentials:
namespace: kargo-demo
secretName: snow-creds
type: api-token
tableName: change_request
ticketId: ${{ task.outputs.snowquery.sys_id }}
uses: snow-wait-for-condition
- as: snowdelete
config:
credentials:
secretName: snow-creds
type: api-token
tableName: change_request
ticketId: ${{ task.outputs.snowquery.sys_id }}
uses: snow-delete