How to create a "select file" or "select folder" element in new UiPath Forms

I finally figured this out!

Add a Text Field to your form, Field Key is file. Set it to disabled (optional).

Add a button, Action is event, Field Key is selectFile, label is Select File.

Now mouse over the button and click the Create Trigger icon:

image

Name the form trigger and click Create:

image

In the Form trigger activity, choose “Select File clicked” for Event:

image

Add a Browse For File activity, output the path to SelectedFile:

image

Add a Set Form Values activity.

image

In the Dictionary, assign the SelectedFile value to the file object:

image

NOTE: If the Arguments field is locked/disabled, add a value to (or remove the value from) the Instance Name field. The change in this field seems to trigger unlocking the Arguments.

Now your Select File trigger looks like this:

Make sure you have a Run Local Triggers after you display the form:

image

Run your automation, click the Select File button, select a file (sometimes the window appears behind others and you have to look for it), and then click Open, and VOILA now you have a text box on the form that has the file path in it!

image

2 Likes

Thanks Paul, mean it!

2 Likes

Thanks for the screenshots and the walkthrough @postwick .

I was able to do everything except getting back the value(file oath) as you have shown ‘file = SelectedFile’. I believe once clicked on “continue workflow execution”, bot has already passed the ‘Show Form’ screen where the actual variable was supposed to be assigned. Basically I need help me retrieving the value back in the Main Flow where show form was called. Let me know if anyone has the answer or encountered the same issue. thanks

1 Like

Use the Get Form Values activity.

1 Like

The problem was the Submit button next to Select File button. I changed it to a simple button and get form values, everything working now. Thank you!!

2 Likes

Ahhh yes, that’s a great point I should have included. You never want to use a Submit button on the new forms, you won’t be able to get the values that were on the form when it was submitted - because the Submit button closes the form.

Change it to an event button and create a Trigger for the button. Then in the Trigger you can Get Form Values, and the Close Form.

1 Like