I have 6 workflows, each invoked into the other (For eg. Workflow 1 is invoked into 2, 2 into 3, 3 into 4 and so on). The 7th workflow is the Main workflow into which I have invoked the 6th one. In each workflow, I am using “Create Exception” and “Throw”. The 7th workflow (the main) is put in a Try-Catch block.
I need to catch any exception occuring in any of the 6 workflows and save them in an excel.
An idea would be to create a string variable to which you assign the value of exception.source or exception.message, whichever you want, then, at the start of any catch block you’ll write it into the excel file.
I would recommend using a Data Table to collect all your errors. Then, as a final step in your outer-most flowchart, you can write this Data Table to an Excel file. This method has several advantages:
Writing the errors straight to Excel every time you run into one would mean that Excel will constantly be opening/saving/closing in the background of your process every time it encounters an error. If you instead save errors to a Data Table and then write them all to Excel in a single step at the end of your process, Excel will only have to open/save one time.
Each error will be on its own line in Excel, and all you will have to do to add an error entry is use the “Add Data Row” activity to add a row to the bottom of your Data Table. (No need for a row counter or anything like that.)
The “Write Range” activity is specifically designed to transfer an entire Data Table into an Excel document like this, so that will also be a very clean/simple step at the end of your process.
Hope this helps! You can let me know if you need help with Data Tables.