UiPath Activities

The UiPath Activities Guide

Create Form

UiPath.Form.Activities.FormActivity

Creates a customizable form, which can be configured from a wizard that is opened by clicking the Open Form Designer button in the body of the activity. The form retrieves all the data that is input by the user and stores them in variables which can be then reused in the automation process. The Do container in the activity enables you to perform subsequent actions when the form opens or while the form is running.

Properties

Common

  • ExecuteDoBlockFirst - If selected, executes the activities in the Do section of the activity before opening the form. By default, this check box is cleared.
  • FormTitle - The title that the form displays at runtime. This field supports only strings and String variables.
  • Isolated - If this check box is selected, the form runs in a separate Windows process. By default, this check box is cleared.

Note:

Selecting this check box enables Validation Station and Callouts to run seamlessly from the same process.

  • Timer - Specifies the amount of time (in seconds) until the form is closed. Leaving this field empty causes the form to never automatically close. By default, this check box is cleared.

Data Bindings

  • FormFieldsCollection - This property field can be used to bind workflow variables into the form fields keys and can have a direction specified as IN, IN/OUT, OUT. Variables in this field also contain form output when the direction is set to IN/OUT or OUT. This field supports only Dictionary<String,Argument> objects.
  • GenerateInputFields - If selected, automatically generates a form schema based on the object added in the
    FormFieldsCollection property field. By default, this check box is selected.

Note:

Adding objects that contain multiple fields in the FormFieldsCollection property field renders all of the input fields that are present in that object if the GenerateInputFields check box is selected.

DataTable

  • MaxColumnsForSchemaGeneration - Specifies the maximum number of columns used when automatically generating DataTable schemas. By default, this field is set to 6. This field supports only Int32 variables.

Format

  • DisableMaximize - If selected, disables the Maximize and Restore buttons on the form window. By default, this check box is cleared.
  • DisableMinimize - If selected, disables the Minimize and Restore buttons on the form window. By default, this check box is cleared.
  • FormHeight - The height of the rendered form window, specified as an Int32 variable. This field supports only Int32 variables. By default, this field is set to 400.
  • FormWidth - The width of the rendered form window, specified as an Int32 variable. This field supports only Int32 variables. By default, this field is set to 800.
  • IsReadOnly - If selected, disables editing the form fields. Only fields that are specified as Always Enabled in the Form Designer are editable if this is selected. By default, this check box is cleared.
  • WindowPositionX - The starting position of the left margin of the form window, expressed in pixels. This field supports only Int32 variables.
  • WindowPositionY - The starting position of the top margin of the form window, expressed in pixels. This field supports only Int32 variables.

Input

  • FormFieldsInputData - Passes JSON input data to the form. If this property is used, the values in the FormFieldsCollection property are ignored. This field supports only strings and String variables.

Important!

To pass JSON into this field for a data grid, you must structure the data as a JSON Array.

Misc

  • DisplayName - The display name of the activity.
  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.

Output

  • Dismissed - If the user manually clicks the Close Window button without filling in any form fields, the Boolean variable in this field is set to True. Otherwise, the variable is set to False. This field supports only Boolean variables.
  • FormFieldsOutputData - The JSON data that results from the form upon completion, stored in a String variable. This field supports only strings and String variables.
  • SelectedButton - Stores which of the UI elements in the form were interacted with by the user in a String variable. This field supports only strings and String variables.

Form Designer

By clicking the Open Form Designer button in the body of the activities, the Form Designer wizard is opened. This wizard helps you create a custom form by enabling you to select what kind of UI elements you want present in the final form and in what order they should be displayed.

Types of Form Fields

On the left side of the wizard, you can find the four categories of widgets you can use to populate your form. To add one of these form fields to your form, simply select one and drag and drop it to the canvas on the center of the Form Designer. The four categories are:

  • Basic Components - This category contains the most used form fields, such as Text Field, Number, Password, File/Folder Path, or buttons, check boxes, and so on.
  • Advanced - This category contains from personal data such as Email or Phone Number, to more complicated fields, such as Date/Time, Currency, and even HTML Element.
  • Layout - Contains elements that alter the layout of your form, enabling you to add Tabs, Panels, Columns, or Tables to your custom form.
  • Data - This category contains grids and containers specialized for harvesting data.

Customizing a Form Field

Once you have dragged a form field from one of the categories described above, a window is opened that enables you to customize the field in its entirety. This window contains 5 tabs, each enabling you to customize different aspects of the field, as well as offering a preview of the field.

Note:

Hovering over the question button that is located next to the fields displays a tooltip that offers more information on each field.

The 5 tabs are, as follows:

  • Display - Contains various settings regarding the appearance of the field, its position inside the form, its description, and prefixes or suffixes. The check boxes at the bottom of the tab enable you to perform several very important actions, such as:
    • Disabled - Makes the form field read-only.
    • Always enabled - Makes the form field editable even if the IsReadOnly check box is selected.
  • Data - Enables you to specify a default value for the field, and how often or if it should refresh.
  • Validation - Offers options regarding the validity of the data entered into the field, such as minimum or maximum length, as well as the error message that is to be displayed if the data entered is not valid.
  • Field Key - This section lets you associate a key to a form field, enabling you to bind form controls to workflow variables.
  • Conditional - This field enables you to put conditions into place that dictate if certain form fields should be shown only when certain actions affect other fields in the form.

After editing all of these tabs, clicking Save in the right side of the form designer closes the window and saves the field with all the changes you have performed.

Forms can be edited after this step by using the cogwheel button that is displayed when hovering over the field you want to edit.

If you want to duplicate an already existing field, you can use the copy button.

Removing a field can be done by using the delete button.

Example of Passing Dynamic HTML Elements

If you want to pass a dynamic HTML element by using the HTML Element form field type, you can do so by following these steps:

  1. In the FormFieldsCollection property field of the Create Form activity, add an In Argument, which contains the dynamic element you wish to pass, whether it is a string, an image, etc.
  2. Open the Form Designer wizard and drag an HTML Element to your form.

Note:

To add an image in a HTML Element form field, the image has to be added in Base64 format.

  1. Use a p tag in the HTML Tag field.
  2. In the Content editor, add the type of data that you want to pass dynamically by using the expression {{data.variable}}, where variable is the argument that you created at step 1.
  3. Select the Refresh on Change check box.

For example, if you wanted to add an image, you would create an In Argument named sampleImage1 and add it to the FormFieldsCollection property, assign the Base64 string that contains the image to this argument, and the final expression in the Content field should look like <img src={{data.sampleimage1}} height=100 width=100/>

Please note that the Label and Header property fields can also be used to pass elements dynamically in the same way, enabling you to set dynamic labels and headers for form fields.

Using Real-Time Forms

Activities in the 'Do' block will execute activities against the fields of the Form - both reading and writing data. These activities are triggered any time a button is clicked or, optionally, when the form is opened. While activities are being executed, the Form will remain open and editable for the end-user.

Triggering the Do Loop

Buttons are the key to triggering the activities in the Do block of the form. By default, a button will trigger the 'Do' loop and then close the form. To trigger the 'Do' loop and then keep the form open with refreshed values, you must add the following custom property to the 'Field Key' tab on a button: (closeOnSubmit, False).

You can see which button has been pressed on a form by parsing the 'SelectedButton' field in the output.

Update Form Values

Values on the form can be updated by changing the corresponding variables within the 'Do' loop.

The Form Designer Ribbon

Buttons on the ribbon of the Form Designer enable you to perform actions related to saving, exporting, importing, deleting, and previewing forms, as follows:

  • Save - This button saves the form you have generated in the Form Designer. After clicking it, closing the Form Designer returns you to Studio and saves the changes you have made to the form.
  • Save As Template - Enables you to export the form you have created as a template that can be easily reused in other automation processes.
  • Insert Template - Lets you browse for already created form templates, which are easily added to the current project.
  • Clear Form - Deletes all entries in the current form and lets you start from scratch.
  • Preview - Clicking this button enters the Preview mode, which shows you how the form looks like at runtime. This section also enables you to resize the display size of the form, or change its theme from a selection of premade themes.

Note:

Clicking the Themes button in the Preview section displays the available premade themes and enables you to select one for the entire form.

Customizing Themes

Entering the Preview mode and clicking Themes takes you to the Theme selection window, in which you can use the Customize Current Theme button to start customizing the theme you have selected.

In this menu, you can customize the background color of the form, the font that is used, as well as its color and size. Also, buttons that are placed in the form can be customized, the colors used for their background, font, and border, can be edited.

Once you have finished customizing your theme, clicking the Save Customization button lets you name and save your theme for future use.

Updated about a month ago


Create Form


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.