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.
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 operatorCannot 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):
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
Go to CEL expressions in AI SRE to review the comprehensive CEL syntax reference, troubleshooting guide, and advanced patterns.
Next steps
Go to CEL expressions in AI SRE to review the complete CEL syntax reference.
Go to Use Mustache templates in runbook actions to learn about Mustache templates.
Go to Use system fields in runbook actions to learn about available system fields.
Last updated
Was this helpful?