PL-500 · Question #142
You have an automation solution that uses a desktop flow. The flow reads data from a file that is stored on a UserA's machine and writes the data to an application. You import the solution to an…
The correct answer is B. Use the Get Windows environment variable action to read the USERNAME environment variable. When a desktop flow has a hardcoded user-specific file path, it fails for a different user because the username portion of the path does not match; using the USERNAME environment variable makes the path dynamic and portable.
Question
You have an automation solution that uses a desktop flow. The flow reads data from a file that is stored on a UserA’s machine and writes the data to an application. You import the solution to an environment that is connected to UserB’s machine. UserB reports that the flow fails. An alert indicates that the path to a file does not exist. You confirm that the file present on the UserB’s desktop. You need to resolve the issue. What should UserB do?
Options
- ADelete and recreate the file.
- BUse the Get Windows environment variable action to read the USERNAME environment variable
- CModify the action to retry if the process cannot find the file.
- DChange access rights for the file to allow read operations for the PAD process.
How the community answered
(38 responses)- A16% (6)
- B74% (28)
- C8% (3)
- D3% (1)
Why each option
When a desktop flow has a hardcoded user-specific file path, it fails for a different user because the username portion of the path does not match; using the USERNAME environment variable makes the path dynamic and portable.
Deleting and recreating the file does not change the hardcoded path in the flow action, so the same path resolution failure will occur regardless.
Using the Get Windows environment variable action to read the USERNAME variable allows the flow to dynamically construct the correct file path for whichever user is currently signed in. This eliminates the hardcoded dependency on a specific username in the file path, making the flow portable across different user accounts.
A retry modifier does not correct an invalid file path - the path will remain unresolvable on every retry attempt.
The error indicates the path does not exist, not a permissions issue, so changing access rights will not resolve the failure.
Concept tested: Power Automate Desktop dynamic path using environment variables
Source: https://learn.microsoft.com/en-us/power-automate/desktop-flows/actions-reference/system
Topics
Community Discussion
No community discussion yet for this question.