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

工作流活动

上次更新日期 2026年3月12日

执行“在复选框更改时执行阻止”操作

You can configure activities inside the Do block to execute when a specific checkbox in the form is checked or unchecked.

教程

要使用此功能,请执行以下操作:

  1. Add the Create Form activity to your workflow.

  2. Inside the Do block, configure the desired activities.

  3. Open the Form Designer from the Create Form activity.

  4. Drag and drop a Checkbox component.

  5. “数据”选项卡中,单击 ** 计算的值**。这将展开字段列表。

  6. In the JavaScript field, enter the following JavaScript code:

    const updateOnChange = instance.updateOnChange;
        instance.updateOnChange = function(flags, changed) {
              if (flags.modified) {
               instance.emit('execute', instance.component.key , {});
              }
    }
    const updateOnChange = instance.updateOnChange;
        instance.updateOnChange = function(flags, changed) {
              if (flags.modified) {
               instance.emit('execute', instance.component.key , {});
              }
    }
    
    备注:

    上面的代码片段会根据复选框的更改情况触发执行“执行”块中的活动。

  7. 保存表单。

  8. At runtime, when you make changes to the checkbox, notice the activities in the Do block being executed.

结果

When you select the Checkbox component, the Do block executes. For this example, when you select the Checkbox component, a Message Box pops up.

重要提示:

已知问题Do块执行两次:选择复选框组件时和提交表单时。

示例工作流

要查看完整的工作流或供日后参考,请下载XAML 示例

  • 教程
  • 示例工作流

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新