Workflow fails randomly, error handling question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 08:33 AM
We have a flow that is supposed to create some tasks on specific HR service cases and it seems to fail randomly and I don't know why. I would like to add an error handler to the flow that can send me an email with the reason why.
In the email body, are data pill items added there, they will be in the text of the body correct?
Is there any other way to figure out why a flow may or may not have just decided not to start or finish? I looked at the event logs for errors but it doesn't seem to capture the flow issues.
Its very random but like one day it is fine, another it isn't. One day half the cases work and the others dont and I see no correlations between any of the cases that work/don't work that lead me to what is happening.
how do other people deal with this type of flow situation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 10:15 PM
Steps to Add Error Handling & Troubleshoot Flow Failures
Add Error Handler to Send Email Notifications
To catch and report errors, implement an error handler that sends an email with failure details (including data pill items).
Ensure to capture key information such as the Case ID, Task Name, and Error Message.
Step-by-Step Solution:
Step 1: Create a scope (or try-catch block depending on your platform).
Step 2: Add actions and ensure any potential errors are caught.
Step 3: Configure the error handler to send an email with relevant data pill items (error message, case/task ID).
Sample Code for Email Notification:
textCopySubject: Flow Execution Failed Body: The flow failed to create tasks on the following HR Service Case: Case Number: {{CaseNumber}} Error Message: {{ErrorMessage}} Timestamp: {{Timestamp}} Please review the details above for further investigation. Thank you, Your Flow Monitoring SystemEnable Detailed Logging and Run History
Enable logging or check detailed run history to capture errors.
Review execution logs to identify patterns for when the flow fails.
Step-by-Step Solution:
Step 1: Review the Run History in your platform (e.g., Power Automate, ServiceNow).
Step 2: Look for specific error codes or failure messages to trace the cause.
Step 3: Use logs to analyze what part of the flow failed.
Check for External Dependencies or Resource Limits
Intermittent failures may occur due to external dependencies (API calls, rate limits, etc.).
Ensure there are no API call limits, throttling, or missing data impacting flow execution.
Step-by-Step Solution:
Step 1: Review any API limits or external system dependencies your flow interacts with.
Step 2: Ensure that your system can handle the load and isn't throttling requests.
Testing and Simulation
Test the flow in different environments (e.g., dev/staging) and simulate edge cases.
Try identifying specific scenarios or data points that cause failures.
Step-by-Step Solution:
Step 1: Set up a test environment and replicate the cases where failures occur.
Step 2: Try to identify patterns in the failed cases (e.g., specific data, permissions, timing).
Implement Retry Logic
Add retry mechanisms for transient failures, particularly if there are delays or timeouts in external systems.
Implement exponential backoff for retries in case of API timeouts or resource issues.
Sample Retry Code:
javascriptCopyfunction retryRequest(request, retries) { try { // Make API request return await request(); } catch (error) { if (retries > 0) { // Wait and retry after exponential backoff await new Promise(resolve => setTimeout(resolve, Math.pow(2, retries) * 1000)); return retryRequest(request, retries - 1); } else { throw error; } } }Review Platform-Specific Logs for Failures
Look for detailed logs specific to the platform you're using (e.g., ServiceNow, Power Automate).
Identify failure points and narrow down the root cause of the issue.
Step-by-Step Solution:
Step 1: For Power Automate, use Run History to check the flow's execution details.
Step 2: For ServiceNow, check Flow Execution Logs to find any failure or warning messages.
Monitor Flow Performance Using Dashboards
Set up performance monitoring dashboards to keep track of flow failures.
Use tools like Power BI, Performance Analytics, or ServiceNow Analytics to track execution success rates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2025 07:07 AM
how do you turn on detailed logging in Step 2?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2025 09:11 AM
I think I got logging on this workflow working although it doesn't show me everything I don't think. I keep seeing two warning on the creation on one of the task.
borting engine execution because a cursor was not found for context: 7079c96f3ce8665026e29ae603a6c8cb waiting on message: {"cursorLabel":"DEFAULT","waitToken":"yApNHlhSGMxC95fqpEShg0WXuvKrWrbK","message":"RW"}
Runtime value key must be non-null
And I haven't a clue what is null and/or what the first error is talking about. the task still gets created.