@up_1
Let me put that in simple way:
System exception refers to errors originating from the system itself, such as a web application or a standalone application. For instance, when the application is unreachable or when a UI element cannot be located.
Business exception, on the other hand, pertains to exceptions caused by business logic rather than system errors. These exceptions are typically user-defined, such as the condition where an invoice processing automation, the invoice number is anticipated to be numeric. If a string is provided instead of a numeric value, it triggers an invalid data format business exception.". Let's go ahead and great sample business exception for the same.
Creating the Business Exception variable:
- The variable "Business_Exception" is used to store information about any exceptions encountered during the process. In this logic, it's initially set to an empty string to signify that no exceptions have occurred yet.
Validation and Exception Handling:
- Within the loop, each invoice number is validated. If an invoice number is found to be invalid or cannot be converted to a number (an error occurs during conversion), the "Business_Exception" variable is updated to indicate an "Invalid invoice number."
Handling Exceptions:
- After encountering an exception, the process checks if the "Business_Exception" variable is not empty. If it's not empty, it implies that an exception has occurred.
Sending Email Notification for Exceptions:
- If an exception occurs (i.e., an invalid invoice number), the process sends an email notification through Outlook. This email alerts the designated recipient about the issue and provides details regarding the specific record that failed due to the invalid invoice number.
Resetting the Business Exception:
- Once an exception is handled (either by sending an email notification or by the absence of an error), the "Business_Exception" variable is reset to an empty string. This ensures that the variable is clear and ready to capture any subsequent exceptions encountered during the loop iterations.
Business Exception flow:

Excel File:

Error Email:

Code:
Outlook.Launch Instance=> OutlookInstance
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Users\\Documents\\Invoice_Details.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance
Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelData
SET Business_Exception TO $'''%''%'''
LOOP FOREACH CurrentItem IN ExcelData
Text.ToNumber Text: CurrentItem[0] Number=> TextAsNumber
ON ERROR
SET Business_Exception TO $'''Invalid invoice number'''
END
IF IsNotEmpty(Business_Exception) THEN
Outlook.SendEmailThroughOutlook.SendEmail Instance: OutlookInstance Account: $'''deenu@.test.com''' SendTo: $'''deenu@onmicrosoft.com''' Subject: $'''Invalid Invoice''' Body: $'''Processing record failed due to Invalid Invoice number : %CurrentItem[0]%.''' IsBodyHtml: False
END
SET Business_Exception TO $'''%''%'''
END
_____________________________________________________________________________________________________________________
If I've resolved your query, please consider accepting it as the solution and giving it a thumbs up to help others find answers faster.