cancel
Showing results for 
Search instead for 
Did you mean: 

How to save error screen shot and send it over email

KanchanAgarwal
Level 3
Hello everyone,

Could anyone help me, how can I build the functionality in Blue prism which can save the captured screenshots of the error on one drive or SharePoint folder and send the screenshot path link over email with the exception message.

Thanks,
Alex


------------------------------
Alex J
------------------------------
3 REPLIES 3

KanchanAgarwal
Level 3
Can anyone help me for the same to fix

------------------------------
Alex J
------------------------------

Hi Alex,

For this scenario,, I would suggest creating a custom business object to capture screenshot. You can follow the below steps:

1) First create a business object named 'Utility-Screenshots' and the in the page description stage of the 'Initialise' action, add the below dependencies and namespaces under the 'Code Options' tab while selecting the language as 'Visual Basic':

15956.png

Now, create a new action called 'Take Screenshot' with two input parameters called 'Screenshot Folder Path' (Text) and Screenshot File Name' (Text) as shown below:

15957.png
Add the code stage as shown above and use the below input parameters and code. No output parameter as such is required :

15958.png
15959.png

The code is as follows:

' Initialize variables

Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics

'Set screen related parameters

bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)

'Generate screenshot

graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(0, 0, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)

'Save Screenshot
screenshot.Save(Screenshot_Folder_Path+"\"+Screenshot_File_Name)
screenshot.Dispose

Test Results:


15960.png
15961.png

From the process studio, you can easily invoke this action whenever you are in the unhappy path from you 'Recover' and 'Resume' stage and once the screenshot has been saved at the given file path, you can use either 'SMTP/POP3' or Outlook VBO to send an email with this screenshot as an attachment

Let me know if it helps!!


------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Automation Consultant
Blueprism 6x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Thanks a lot Devneet for the detailed info.

------------------------------
MuraliKrishna
Senior Consultant - Automation Developer
------------------------------