In this article, we will learn about how we can integrate UiPath Apps with Storage Buckets in Orchestrator & then we will build an app that will upload the file to the Storage bucket using FilePicker.
How to Integrate UiPath Apps & Storage Bucket**
To start with, firstly we will create a Storage bucket in the UiPath Orchestrator. Lets say PDFFileStorage
Now, we will integrate this created storage bucket in UiPath Apps.
Step 1- We will go to UiPath Apps in the UiPath cloud automation platform and we will click on plus button.
Step 2:- We will choose the option “Storage Bucket” from the list.
Step 3:- We will select the bucket from the folder that we have created in orchestrator.
Step 4:- We will notice that our storage bucket is now added in UiPath App Studio under the Orchestrator section.
How to build an app to upload a file to Storage Bucket with UiPath Apps.
Interface of an App
Step 1- To upload a file , we will use FilePicker control of UiPath Apps.
Step 2:- We will put a label over the file picker & under General tab provide the text to the label.
Step 3:- Use the button that will be clicked by the user to upload the file to Storage Bucket & provide the name to the button.
**Step 5:-**We have certain properties of the File Picker, such as we can set the max file size that are allowed to be upload, then under allowed file types we can mention the file types that you want to be upload.
At the bottom, we have an option Download Only, we will not check this option as here we are only uploading files & not downloading it.
Our App Interface is now ready!!!
Now, we will set events ,rules & expressions to our controls.
How to set Events, rules & expressions
For Upload Button
Step 1:- Click on Upload button & then under Events tab click on create rule.
Step 2:- Under File to Upload option we will pass the value **“File Picker”.**Pass the storage bucket in which we need to upload the file.
Note:- Always use = sign to set the item in the field.
***We will discuss about Uploaded File Name later on & talk about the variable varFileName
Step 3:- We could add as many rule as we want for one control. Therefore, once the file will be uploaded , then we will set the uploadfile name to some variable lets say varUploadedFileName.
Step 4:- Once the file will be uploaded , then we want the display message to show the result. So, we used the variable varStatusMessage and assign the value which will be an expression to build the text.
Step 5:- In case any error occured, then we will set the error message to the varStatusMessage.
Step 6:- Go to General Tab and at the bottom we will see an option Disabled.
If the value is set to True , then item is not disabled else it is disabled.
We set an expression here, IsBlank(FilePicker_Upload_File.fileType) which means if the file type is different than pdf , then the upload button would be disabled.
We can set the file type as shown below.
For File Picker
Step 1:- We will click on File Picker , go to Events tab & we will see there are 2 options — File added & File removed
We will first create a rule for File added.
Step 2:- Firstly we wil set the values to the variable such as File Name & File type. We are doing this because if we need to reuse these values then we can directly use the variables.
We will store the File Picker File name to the variable varFileName
Step 3:- We will now store the File Picker file type to the variable varFileType.
Step 4:- We will then use ShowMessage to display the result.
We will now create a rule for File Removed.
We will set all the variables to blank.
In the Upload Button, we have 2 options to set the UploadFileName.
- Auto-generate name- If we enable this option then the random generated name would be set to the file name.
- varFileName- This is the variable that stores the File picker file name.
Step 1:- We will assign the variable varStatusMessage to the text area to display the result.
Our App is now ready, lets now run the app.
I hope you enjoyed the article.