UiPath Documentation
activities
latest
false
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

工作流活动

上次更新日期 2026年4月7日

实时表单

“实时表单”功能使您能够修改正在使用的表单中的值,而无需关闭表单。 这意味着可以轻松修改链接到您正在使用的表单字段的变量,而无需关闭工作流,然后再次运行。

要利用此功能,请将所需的活动拖放到创建表单活动的执行块中。在表单中配置要链接到“执行”块中活动的字段和按钮。

使用实时表单

Activities in the Do block execute 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 remains open and editable for the end-user.

触发 Do 块

To trigger the activities in the Do block of the form, use buttons.

By default, a button triggers the Do loop and then closes the form.

To trigger the Do loop and keep the form open with refreshed values, add a custom property to the Field Key tab on the desired button with the key-value pair closeOnSubmit-false.

To see which button was used on a form, parse the SelectedButton property of the output object.

更新表单值

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

教程

我们来创建一个简单的表单,其中包含两个组件: “用户名”“城市”

  1. Drag and drop the Create Form activity in your sequence workflow.

  2. Open the Variables panel and create two global variables, one for each component.

    docs image

  3. In the FormFieldsCollection property of the Create Form activity, add an In/Out argument of type String for each component, and reference them to the previously created global variables. In this way, the components are autogenerated in the form.

    docs image

    要使用“实时表单”功能,请在表单中创建单击后不会关闭的按钮(例如,更新按钮):

  4. 打开表单设计器。

  5. Drag and drop a Button component.

  6. 导航至按钮组件的“字段键”选项卡。在“自定义属性”下,添加closeOnSubmit作为“键” ,并将“值”设置为false 。请注意您为字段键设置的名称。此名称用于绑定表单中的组件,并区分大小写。创建此按钮后,您可以使用If等活动来实时更改表单或表单背后的数据库中的值。

  7. 要跟踪业务用户单击的按钮,请创建一个变量来存储该按钮:在“创建表单”活动 > “输出”类别 > “选定按钮”字段的“属性”面板中,单击以为按钮创建“变量” 。或者,也可以使用CTRL + K键盘快捷键来创建变量。该变量还将添加到序列工作流的“变量”面板中。

  8. 为按钮变量命名(例如 btn)。

    docs image

    要在“If”活动中使用特定于表单的按钮,请使用btn = " ... "表达式引用它们。请确保使用正确的语法,具体取决于您选择的编程语言(C# 或 VB.NET)。在此示例中,监控表单中的“更新”按钮。

  9. Drag and drop the If activity in the Do block of the Create Form activity.

  10. “条件”字段中,输入表达式:如果使用 VB.NET,则输入btn = "{button_field_key_name}" ;如果使用 C#,则btn == "{button_field_key_name}" 。将{button_field_key_name}值替换为您在步骤 6 中设置的值。随后,您可以为此条件创建规则。例如,单击“更新”按钮后,您希望在“用户名”字段中显示Database Updated

    • In the If activity > Then section, drag and drop the Assign activity.
    • In the To field of the Assign activity, enter the global variable used to reference the Username field of the form.
    • In the Value field, enter "Database Updated".

    docs image

    现在,运行表单使您能够实时进行更改,而无需关闭并重新打开表单。

示例工作流

要查看完整的工作流或供将来参考,请下载已存档示例

  • 教程
  • 示例工作流

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新