Run process on validation success

I have a scenario where I need to download an Excel file from an email attachment.

Once the file is downloaded, I need to apply certain validations on the data in the file.

If the file passes these validations, I will proceed with the process.

However, if the file fails the validations or is missing, the bot should throw an error, send an email notification, and stop the process in the RE framework.

Hi @Komal_Chauhan

If you’re checking for the file in the Initialization state, and it’s missing or fails validation, the bot will throw an error, and the process will immediately move to the End Process state. However, if you perform the check in the Process state, and the file is missing or doesn’t meet validation, you can set the TransactionItem to 0, ensuring the process stops gracefully. In this case, you can also send an email notification before the process ends, allowing for better error handling while ensuring proper notification.

1 Like

Here’s a step-by-step breakdown you can refer using RE Framework:

  1. Retrieve Emails: Use the Get Outlook Mail Messages or Get IMAP/POP3 Mail Messages activity to retrieve the emails.
  2. Download Attachment: Filter emails for the desired Excel file and use Save Attachment activity to download it to a folder.
  3. Read Excel File: Use Excel Application Scope and Read Range activities to open the downloaded Excel and read its contents into a DataTable.
  4. Apply Validation: Implement validation logic using If conditions to check for missing data, invalid formats, or specific value ranges.
  5. Throw Exception on Failure: If the file fails validation, use the Throw activity to raise a BusinessRuleException.
  6. Catch Exception: In the Catch block of the REFramework, handle the exception (both BusinessRuleException and System.Exception).
  7. Send Email Notification: Use the Send Outlook Mail Message activity to send an error notification when validation fails.
  8. Stop the Process: After handling the exception and sending the email, transition to the End Process state to stop the workflow.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.