Data Service
latest
false
  • Getting started
    • Introduction
    • The User Interface
    • Regions and Instances
  • Licensing
  • Setup and configuration
  • Using Data Service
  • Reference
    • Data Service Studio Activities
    • API Access
  • Examples & Tutorials
    • Using Entities in Projects
    • Uploading File Fields in Entity Records
    • Downloading File Fields in Entity Records
    • Uploading Data From CSV Using Batch Activities
Banner background image
Data Service User Guide
Last updated Mar 15, 2024

Downloading File Fields in Entity Records

Using Studio you can easily manipulate specific files of an entity record. These activities allow you to execute operations such as upload, download, or delete specified files of a specified field of an entity record.

The following example demonstrates how to automatically download from Data Service a specified file containing information from the Olympics games extracted from Wikipedia pages in order to use it for other operations.

Prerequisite: Create Entities in Data Service

Following the steps detailed on the Creating an Entity page, we created an entity for storing information about the Olympic games.

The Olympics entity has the following fields: Name (text) and Logo (file).

Check out the following pages:

  • the Upload File activity as it contains details about how to use this activity to easily upload the logos;
  • the File page as it provides details on how to upload logos from the platform.

    Note: System built-in fields are automatically added to your entity in order to provide details about its creation.


Step 1: Build the Workflow

Query Related Records

We use the Query Entity Records activity to pull up a list of records from the Olympics entity from Data Service by setting up the folder variable. This goes through all records from the Name field and outputs them in the olympicsRecords variable to be used in the following Input Dialog activity.


Create an Input Dialog Box

Add the Input Dialog activity to display a dialog box containing the Select label message and a Multiple choice Input Type. In the Input array add the olympicsRecords variable created previously for the Query Entity Records activity for which you'll apply the following function: olympicsRecords.Select(Function (o as Olympics) o.Name).ToArray to set up the array of options to choose from.
Set up the selectedOlympics variable to gather the output results.


Assign a Value to the File

Use the Assign activity to assign the olympicsRecords.First(Function (o as Olympics) o.Name = selectedOlympics) variable created previously in the Input Dialogue activity to the new olympicEdition variable.


Set up a Select Folder Dialogue Box

Add the Select Folder variable to open a dialog box and create the folder variable for the output folder path. You'll use this variable in the following Download File from Record Field activity.


Download File From Record Field

Use the Download File from Record Field activity to download the folder file from the Logo file of the olympicEdition.Id entity record.


Set up a Power Shell Command

Add the Invoke Power Shell activity to execute the following command line: Path.Combine(folder, olympicEdition.Logo.Name) in order to combine the following input parameters: folder and olympicEditionvariables and the Logo and Name fields created within the Olympics entity.

The purpose of this activity is to invoke the full path of the file and open it in the default photo viewer or editor.



[Optional] Comment Out

As an optional step, we've added an example of how to perform a file deletion which has been commented out to not delete the file at runtime. To do this we added the Comment Out activity. Here we included the following activities that won't be executed at runtime:

Please note that you can uncomment it to try it out.



  1. Set up the child activities order.

    We added a Sequence activity that we've renamed Ignored Activities.

  2. Here include the Delete File from Record Field activity to remove the file from the specified entity record field.


  3. For the Delete File from Record Field activity to work as expected set it up as follows:
    1. Set the Record ID to the olympicEdition.Id variable created within the Download File from Record Field activity.
    2. The Field from where you want to delete the file is the Logo file created in Data Service record created at the beginning of this example.
    3. The Output Record is the olympicEdition variable created within the Assign activity.


Once finished, your project should look like this:



Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.