Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

ServiceNow approval step

Pause pipeline execution and wait for a ServiceNow ticket to reach a specific state before continuing.

The ServiceNow approval step pauses a pipeline and polls a ServiceNow ticket at a configurable interval. When the ticket fields match your approval criteria, the pipeline resumes. If they match your reject criteria, the pipeline fails. If polling continues past the step timeout without a match, the step expires.


What you will learn from this topic

  • How to add a ServiceNow approval step to a pipeline

  • How to configure the ServiceNow connector, ticket type, ticket number, and polling interval

  • How to define approval and reject criteria using field conditions or a JEXL expression

  • How to restrict approvals to a change window

  • The complete YAML reference for serviceNowApproval


Before you begin

  • ServiceNow connector: You need a ServiceNow connector configured in Harness. Go to Connect to ServiceNow to create one.


Add the step

In Pipeline Studio, click + to add a step inside a stage, then search for approval in the step library. Select ServiceNow Approval.


YAML


Configure the step

Required fields

The following fields are required to configure the step.

Field
Description

Name

Display name for the step in the execution view.

ServiceNow Connector

The ServiceNow connector that authenticates to your ServiceNow instance.

Ticket Type

The ServiceNow table or ticket type to poll (for example, change_request, incident, or a custom type).

Ticket Number

The specific ticket number to poll (for example, CHG0000001). Supports runtime input <+input> and expressions.

Approve Criteria

Conditions that must be met for the pipeline to proceed. Go to Approval and reject criteria for details.

Optional configuration

The following fields are optional.

Field
YAML key
Default
Description

Retry Interval

retry

1m

How often Harness polls the ticket for a status change.

Reject Criteria

reject

None

Conditions that cause the pipeline to fail immediately. Go to Approval and reject criteria for details.

Change Window Start

change_window_start

None

Earliest time the approval is valid. Accepts an ISO 8601 datetime or expression.

Change Window End

change_window_end

None

Latest time the approval is valid. After this time the step fails even if criteria are met.

Log Level

log_level

info

Verbosity of step logs. Accepted values: info, warn, error.

Advanced settings

The step supports the same advanced settings as any other step.

Setting
Description

Timeout duration

Maximum time the step is allowed to run before Harness terminates it.

On failure

What Harness does when the step fails.

Strategy

Loop the step using a matrix, for, or while strategy.

Conditional execution

Skip the step based on a JEXL condition.

Go to Steps overview for details on these settings.


Approval and reject criteria

approve is required; reject is optional. Both fields accept the same criteria format.

Conditions

Click + Add criteria and select Conditions as the condition type. Then choose your match mode and define each condition.

Match mode

Value
Behavior

Any condition

Pipeline advances when at least one condition matches (OR logic).

All conditions

Pipeline advances only when every condition matches (AND logic).

Each condition has three fields: Name (the ServiceNow field name), Operator, and Value.

In YAML:

Set match-any-condition: true for OR logic. Omit it or set it to false for AND logic.

JEXL expression

Select JEXL Expression as the condition type and enter an expression that evaluates to true or false.


Change window

The change window fields restrict when an approval is accepted. Harness continues polling throughout, but only accepts an approval result while the current time falls within change_window_start and change_window_end. If the window closes before the approval criteria are met, the step fails.

Both fields accept expressions:


YAML reference

The following table lists all supported keys for the serviceNowApproval step.

Key
Required
Type
Description

connector

Yes

string

Identifier of the ServiceNow connector. Use account., org., or no prefix for the matching scope.

ticket_type

Yes

string

ServiceNow table or ticket type to poll.

ticket_number

Yes

string

Specific ticket number to poll.

approve

Yes

object

Criteria that advance the pipeline.

approve.match-any-condition

No

boolean

true for OR logic; false or absent for AND logic.

approve.conditions

No

list

Field conditions. Each entry: field-name: { operator: value }.

retry

No

duration

Polling interval. Default: 1m.

reject

No

object

Criteria that fail the pipeline. Same structure as approve.

change_window_start

No

string

ISO 8601 datetime or expression. Approval only accepted on or after this time.

change_window_end

No

string

ISO 8601 datetime or expression. Approval rejected after this time.

log_level

No

string

Log verbosity: info, warn, error. Default: info.

Supported operators: eq, not_eq, in, not_in.


Next steps

Last updated

Was this helpful?