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

Use CEL Expressions in Runbook Actions

Add conditional logic and transformations to runbook actions with inline CEL.

CEL (Common Expression Language) expressions provide logic and transformation capabilities beyond simple variable substitution. Use CEL when you need conditional logic, calculations, regex matching, or string transformations.

CEL expressions cannot be tested or previewed before execution. Syntax validation occurs when you save, but runtime errors only appear in execution logs. Test in non-production environments first.

FEATURE FLAG REQUIRED

CEL expressions require the IR_CEL_CONDITIONS feature flag. Contact your Harness account team to enable this feature.

CEL syntax basics

CEL expressions use ${{expression}} syntax and can be embedded inline with text.

Basic syntax:

${{incident.field_name}}              // Simple value
${{incident.severity == "0"}}         // Boolean condition
${{incident.severity == "0" ? "CRITICAL" : "Normal"}}
// Ternary operator

Cannot mix with Mustache:

// ❌ This will fail - mixing CEL and Mustache
Incident ${{incident.severity}} is {{incident.title}}

// ✅ Use CEL only
Incident ${{incident.severity}} is ${{incident.title}}

// ✅ Or Mustache only
Incident {{incident.severity}} is {{incident.title}}

Inline conditional expressions

Severity-based formatting:

Environment-specific warnings:

Multi-level conditions:


Inline calculations

Error rate percentage:

Affected users with threshold logic:

Response time in seconds:


Inline string operations

String concatenation:

Case conversion:

Substring extraction (if supported):


Inline regex and pattern matching

Check if service matches pattern:

Extract meaningful info from title:


Working with collections and Activity data

Extract Harness service IDs for pipeline triggers:

When you need Harness service IDs (UUIDs) instead of just service names, use the Activity.impacted_services collection:

Get first impacted service ID:

Filter API services and get their IDs:

Count impacted services:

Build a formatted list of services:

Use in Harness pipeline trigger (JSON body):

WHY ACTIVITY INSTEAD OF INCIDENT?

incident.service returns a simple string (e.g., "payment-api"). Activity.impacted_services returns an array of objects with .id (Harness UUID) and .name properties, which you can use for triggering pipelines or making API calls.


Complex inline examples

Slack message with comprehensive CEL logic:

Jira ticket with dynamic priority and description:

Summary field:

Description field:

ServiceNow incident description with inline CEL:


Using previous action outputs with CEL

Reference Zoom meeting output:

Conditional based on previous action:

Chain multiple outputs:


CEL inline expression limitations

Single line only:

No block statements:

Cannot define variables:


CEL best practices for inline expressions

1. Check for null values:

2. Use parentheses for clarity:

3. Keep expressions readable:

4. Provide fallback values:


Troubleshooting CEL inline expressions

A CEL inline expression in an AI SRE runbook action is not evaluating

Confirm the IR_CEL_CONDITIONS feature flag is enabled, the field is in COMPLEX mode, and you wrapped the expression in ${{}} rather than {{}}.

A CEL inline expression in an AI SRE runbook action returns a syntax error on save

Check for unclosed strings or parentheses, verify field names are spelled correctly (case-sensitive), and use == for comparison rather than =.

A CEL inline expression in an AI SRE runbook action produces a runtime error in the logs

Add null checks such as field != null && field.method(), verify the field exists in your incident or alert type, and confirm data types match.

Go to CEL expressions in AI SRE to review the comprehensive CEL syntax reference, troubleshooting guide, and advanced patterns.


Next steps

Need Help? Contact our support team by email at support@harness.io or visit the Harness Documentation for additional resources and troubleshooting guides.

Last updated

Was this helpful?