Includes
Checks if a string contains a specified substring, returning true or false.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- String - The string to search in.
- Substring - The substring to search for.
Options
This node does not have configurable options.
Output
- Result - Boolean value:
trueif substring is found,falseotherwise.
How It Works
The Includes node performs a simple substring search:
- Case-sensitive: "Hello" and "hello" are different
- Returns boolean: true if found anywhere in string, false otherwise
- Exact match: Must match the substring exactly
- Empty substring: Always returns true
Usage Examples
Example 1: Check if Word Exists
- String:
"Hello World" - Substring:
"World" - Result:
true
Example 2: Substring Not Found
- String:
"Hello World" - Substring:
"Goodbye" - Result:
false
Example 3: Case Sensitivity
- String:
"Hello World" - Substring:
"world" - Result:
false(lowercase 'w')
Example 4: Partial Match
- String:
"user@example.com" - Substring:
"@" - Result:
true
Example 5: Check File Extension
- String:
"document.pdf" - Substring:
".pdf" - Result:
true
Tips
- Use for quick existence checks - no position information needed
- Combine with If node for conditional logic
- Search is case-sensitive - use Lowercase node first for case-insensitive search
- More efficient than Index when you only need true/false
- Use for filtering, validation, and conditional routing
- Empty substring always returns true
Common Errors and Solutions
Error: Returns false when substring should exist
- Cause: Case sensitivity mismatch
- Solution: Convert both strings to same case before checking:
1. Lowercase both strings
2. Then use Includes
Error: Need position, not just true/false
- Solution: Use Index or LastIndex instead to get position
Practical RPA Examples
Example: Filter Emails by Domain
String: ${msg.email} // "user@company.com"
Substring: "@company.com"
Result: true
Action: Process only company emails
Example: Detect Error in Log
String: ${msg.logLine}
Substring: "ERROR"
Result: true/false
Action: If true, send alert
Example: Validate File Type
String: ${msg.filename}
Substring: ".xlsx"
Result: true/false
Action: Process only Excel files
Example: Check for Keyword
String: ${msg.productDescription}
Substring: "premium"
Result: true
Action: Apply premium pricing
Example: Filter by Category
String: ${msg.categoryPath}
Substring: "/electronics/"
Result: true/false
Action: Route to electronics department
Example: Spam Detection
String: ${msg.emailSubject}
Substring: "URGENT"
Result: true
Action: Mark as potential spam
Use with Conditional Logic
Pattern: Filter Items
For each item:
1. Includes check for keyword
2. If true: Add to filtered list
3. If false: Skip
Pattern: Route Based on Content
1. Includes check for "urgent"
2. If true: High priority queue
3. If false: Normal queue
Pattern: Validation
1. Includes check for required text
2. If false: Return validation error
3. If true: Continue processing
Case-Insensitive Search
For case-insensitive matching:
Step 1: Lowercase on input string → "hello world"
Step 2: Lowercase on search string → "world"
Step 3: Includes check
Result: true (case-insensitive match)
Multiple Substring Checks
To check for multiple possible substrings:
Option 1: Multiple Includes nodes (OR logic)
- Check for "error" OR
- Check for "failure" OR
- Check for "exception"
Option 2: Lowercase + combine keywords
- Concatenate alternatives
- Single Includes check