Hi there,
I have a Power Automate Desktop flow that reads data from a CSV file (source) where each row consists of 4 columns.
It then opens a Desktop Application and uses a "for each" loop to populate text fields in the application and presses the "OK" button to submit the data. That all works well if the data is valid.
My problem is I cannot seem to capture Desktop application error messages on screen if they appear, is there a way to do this?
Valid data meaning datatypes are correct for each field (whole number, text field, date etc.) and numbers are not negative or too large, if so, the Desktop application produces an error message on screen with details of the error.
The Desktop application could also produce an error after all 4 fields and been filled in, the "OK" button is pressed but the data is not valid, example the project number does not exist etc.
So there are multiple different error messages that may appear, depending on what triggered it. The error message dialog box appears approximately in the same position on the screen each time regardless of what the error is. That is, if the position of the error message box could be used to determine if an error occurred, that might work.
Each CSV file consists of 100+ rows, ideally I want the flow to enter them one-by-one and if a Desktop application error appears on screen, the row gets written to an CSV error log file and continues the loop to the next row until finished.
Have tried surrounding the process in a "On Block error" but that does not capture the error message that may or may not appear on screen.
My guess is that somehow I need to use an "If" statement on the error message dialog box, so that if an error message appears, than write to log file, else proceed to next row. But haven't been able to figure it out the logic so far...
Any help would be much appreciated.
Thanks
Nick
Solved! Go to Solution.
Hi NIck,
Your guess is correct!!
you need to check for some kind of selectors that signifies whether the transaction is successful or failed using the if statement.
1) set a variable(Status) and flag it true/false based on successful/failure activity, inside if statement, or on block error action.
2) then based on a variable (status) value, use the next loop action to skip that iteration and go for the next row (you can use label/goto action )
Hope this helps !!
Regards,
AR
Hello
thank you for the detailed write-up. Have you tried the "If Window Contains" block?
Here are the steps you need to take:
1. create the circumstances that make the app throw the error
2. capture the UI element that consists of that error message dialog
3. in your desktop flow, drop the "If Window Contains" block
4. inside the If Window Contains block, add your logic to write to the log file the data from the CSV that didn't get written to the app
to reach the error message dialog, you can either capture the UI element by going to the UI elements pane > Add UI element > reproducing circumstances of errors > Ctrl-Click on the error message dialog when it appears
hope this helps, let us know if it doesn't!
Best,
Amina
Hi NIck,
Your guess is correct!!
you need to check for some kind of selectors that signifies whether the transaction is successful or failed using the if statement.
1) set a variable(Status) and flag it true/false based on successful/failure activity, inside if statement, or on block error action.
2) then based on a variable (status) value, use the next loop action to skip that iteration and go for the next row (you can use label/goto action )
Hope this helps !!
Regards,
AR
Hey Nick,
I wrote my own error logging as I find it better for me. For your situation you potentially are most interested in the take a screenshot function. Capture a screenshot when the error occurs.
Also use "Get Last Error" and use that to create your own error log in notepad.
If you like I can email you a screenshot of what I use in the desktop client.
Below looks pretty hard to understand but I can't find a nice way to copy it in here.
What I'm doing here is taking the error and saving it into a notepad document. I'm also taking a screenshot of the screen when the error occured. This keeps a nice log of the time the error occured and what it was doing when it errored.
I use a block rescue and the block rescue calls the subflow "ErrorHandle".
Lastly the program is retrying the whole action under a block error 3 times. If it fails more than 3 times it will discount the row; mark error and message me via email that the row failed. It will then try the next row.
ERROR => LastError
Variables.IncreaseVariable Value: ErrorThreeTimesOnSameCandidate IncrementValue: 1 IncreasedValue=> ErrorThreeTimesOnSameCandidate
Variables.IncreaseVariable Value: ErrorCount IncrementValue: 1 IncreasedValue=> ErrorCount
File.WriteText File: $'''%PathToDesktop%\\PowerAutomateBkgCheck\\Errors.txt''' TextToWrite: $'''%ErrorCount%.%ErrorThreeTimesOnSameCandidate% | %CurrentDateTime% | %LastError% | RecentError -> %RecentError% | Last search request -> %SearchingFor%''' AppendNewLine: True IfFileExists: File.IfFileExists.Append Encoding: File.FileEncoding.Unicode
ON ERROR
END
DISABLE System.TakeScreenshotOfForegroundWindowAndSaveToFile File:
$'''%PathToDesktop%\\PowerAutomateBkgCheck\\Errors\\%PersonError%.jpg''' ImageFormat: System.ImageFormat.Jpg
Display.ShowMessageWithTimeout Title: $'''Please don\'t touch while I\'m running!''' Message: $'''Please don\'t touch while I\'m running!
Restarting - Press cancel to stop
An unexpected error occured - %RecentError%
LAST SEARCH REQUEST (OCR) -> %SearchingFor%
Standard Error Message -> %LastError%
This candidate will error out if 3 errors occur. %ErrorThreeTimesOnSameCandidate% out of 3.''' Icon: Display.Icon.None Buttons: Display.Buttons.OKCancel DefaultButton: Display.DefaultButton.Button1 IsTopMost: True Timeout: 5 ButtonPressed=> ErrorButtonPressed
IF ErrorButtonPressed = $'''Cancel''' THEN
System.TerminateProcessByName ProcessName: $'''excel'''
EXIT Code: 0
END
IF ErrorThreeTimesOnSameCandidate >= 3 THEN
IF PersonError = $'''NotYetSet''' THEN
Outlook.SendEmail Instance: OutlookInstance Account: $'''a.pettit@unsw.edu.au''' SendTo: $'''a.pettit@unsw.edu.au''' Subject: $'''Check Background Check Upload - Critical Bookup Error''' Body: $'''Check Background Check Upload - Critical Bookup Error. %ErrorCount%-%ErrorThreeTimesOnSameCandidate% %DateUNSWFormat% %LastError% | RecentError -> %RecentError% | Last search request -> %SearchingFor% | Last Document Type = %DocumentType% | Person -> %PersonError%''' IsBodyHtml: False
EXIT Code: 0 ErrorMessage: $'''Critical Bootup Error'''
END
IF Task = $'''Fit2WorkDownload''' THEN
IF ErrorThreeTimesOnSameCandidate >= 5 THEN
Excel.WriteCell Instance: ExcelInstance Value: $'''CANCELLED''' Column: 16 Row: PeopleProcessedCount + 2
ELSE
Excel.WriteCell Instance: ExcelInstance Value: $'''ERROR - Failed three times on same person.''' Column: 16 Row: PeopleProcessedCount + 2
END
ELSE IF Task = $'''PageUpUpload''' THEN
Excel.WriteCell Instance: ExcelInstance Value: $'''ERROR - Upload Fail - Failed three times on same person.''' Column: 15 Row: PeopleProcessedCount + 2
END
Variables.IncreaseVariable Value: UnprocessedApplicants IncrementValue: 1 IncreasedValue=> UnprocessedApplicants
SET ErrorThreeTimesOnSameCandidate TO 0
END
Excel.Save Instance: ExcelInstance
ON ERROR
END
Hello
thank you for the detailed write-up. Have you tried the "If Window Contains" block?
Here are the steps you need to take:
1. create the circumstances that make the app throw the error
2. capture the UI element that consists of that error message dialog
3. in your desktop flow, drop the "If Window Contains" block
4. inside the If Window Contains block, add your logic to write to the log file the data from the CSV that didn't get written to the app
to reach the error message dialog, you can either capture the UI element by going to the UI elements pane > Add UI element > reproducing circumstances of errors > Ctrl-Click on the error message dialog when it appears
hope this helps, let us know if it doesn't!
Best,
Amina
Hi @AshleyPettit, thank you for the detailed response. I will try that out. As you said its not so easy to follow in text form. But the description of the logic makes sense, so I'll see if I can use it. Thanks! 😊
Thank you @aminab-msft, That makes sense, will give that try. I have got it working now after a lot of blood sweat and tears. I am dealing with an old custom legacy desktop app, hence the reason PAD was not capturing/seeing the modal dialog error message. I did a simple flow, focused on producing the error and used breakpoints to step through the error message. I used 'Get details of window' to check if any text from the error message captured, and if so triggered the error handling sub flow, which works.
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24 17 @Anil_g 7 @ManishSolanki 13 @eetuRobo 5 @David_MA 10 @VishnuReddy1997 5 @SpongYe 9JhonatanOB19932 (tie) @Nived_Nambiar 8 @maltie 2 (tie) @PA-Noob 2 (tie) @LukeMcG 2 (tie) @tgut03 2 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate @Deenuji 12@ManishSolanki 19 @Anil_g 10 @NathanAlvares24 17 @VishnuReddy1997 6 @Expiscornovus 10 @Tjan 5 @Nived_Nambiar 10 @eetuRobo 3 @SudeepGhatakNZ 8 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2 Anil_g2 SharonS2
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages