nerdexam
Microsoft

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.

Support solutions and troubleshooting

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)
  • A
    16% (6)
  • B
    74% (28)
  • C
    8% (3)
  • D
    3% (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.

ADelete and recreate the file.

Deleting and recreating the file does not change the hardcoded path in the flow action, so the same path resolution failure will occur regardless.

BUse the Get Windows environment variable action to read the USERNAME environment variableCorrect

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.

CModify the action to retry if the process cannot find the file.

A retry modifier does not correct an invalid file path - the path will remain unresolvable on every retry attempt.

DChange access rights for the file to allow read operations for the PAD process.

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

#Desktop flows#File paths#Environment variables#Troubleshooting

Community Discussion

No community discussion yet for this question.

Full PL-500 Practice