Blue Prism-Excel-How detect and handle prompt when saving file

mbailey

Member
Hi,

We have an issue with Blue Prism (BP) saving Excel files to a directory that encrypts the file and locks the directory to other writes while the encrypted save completes. If two BP processes attempt to save files in the same directory at the same time, one process will receive a Microsoft Excel prompt indicating that the directory is in use and the save should be tried again later. We need to detect this prompt, click the OK button on the prompt, sleep for a few seconds, and retry the save. The MS Excel VBO.Save Workbook action uses VB.Net to set DisplayAlerts to False and issue the Save command but then freezes while waiting for the Save to complete or fail, which cannot happen until the prompt is dismissed.

I don't know how to detect and dismiss the prompt in the BP code stage that is performing the save. Can anyone help me with a BP code stage that issues the save command but detects and handles this prompt if it appears?
 

mbailey

Member
I should have mentioned that this directory is used by people and other non-BP processes. I could use locks to ensure that only one BP process tries to save at a time but that would not prevent other saves from causing this problem. If this were a C# or VB.Net program, I would write an event handler but I don't know how to approach the problem in BP. I'm looking at the possibility of writing and calling a separate process to wait for and dismiss the prompt window with a timeout if the prompt does not appear but I haven't resolved attaching to Excel with a recognized handle. What I'm looking for here is VB code I can include in the code stage of a new BP object action to save the Excel workbook and, if the prompt appears, to detect it, click the OK button to dismiss the prompt, and allow the save to fail. This will eliminate BP hanging and allow my single BP process to wait for a few seconds before trying the save again. This can be a loop with a maximum number of save attempts that ends with either a successful save or an email back to the user indicating that the save could not be completed.
 

aslam.passion

New Member
Hi mbailey, Nehil is right to handle this case by using environment lock... but as per your case put vbo.save method in a block if it good then it will go to normal flow but if they got poup then wait exception and recover that exception (default time for vbo.save exception is 30 sec of waiting)
then resume the stage after that use a wait stage to check for popup window. if that popup window exist then take action on that ok button to retry it also use sleep as you want according to your logic.
hope it will help.
 

Pete_L

Active Member
I suspect that you can handle this by adding a step in your Save action. Please refer to this link for details related to a similar issue where the poster needed to recognize and handle an alert message.

Hope this helps.
 
Top