UiPath Documentation
activities
latest
false
Integration Service 活动
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

对象和附件

对对象和附件使用 Uipath 连接器。

概述

本指南旨在帮助您创建使用以下 ServiceNow 活动的工作示例:

  • 插入 ServiceNow 记录
  • 获取 ServiceNow 记录
  • 删除 ServiceNow 记录

此工作示例可用于快速验证与 ServiceNow 实例的连接,并熟悉活动的输入/输出数据类型。

完成本指南中的步骤后,您将获得一个自动化序列,该连接器将执行以下操作:

  1. 与 ServiceNow 实例建立连接。
  2. 创建新的 ServiceNow 事件(插入记录)。
  3. 检索记录并输出预期的错误消息 (“获取记录”、“If”)。
  4. 删除创建的事件(删除记录)。

先决条件

在开始之前:

  1. 完成 ServiceNow身份验证步骤。
  2. 要附加到 ServiceNow 记录的本地文件。

步骤

构建项目

  1. 请按照连接器文档中描述的步骤建立连接。
  2. 添加“ServiceNow 作用域”活动。选择“配置” ,选择并测试所需的连接,然后选择“保存”
  3. “ServiceNow 作用域”活动中添加“插入 ServiceNow 记录”活动。
    • Click the Configure button inside the Insert ServiceNow Record activity.
    • In Select Object drop-down list, select Incident.
    • Create and enter a String variable for the sys_id Value (e.g., sysID)
    • Using the Add Single Field textbox, enter short_description. Enter a short_description Value (e.g., "UiPath-Attachment").
    • Click Done.
    • Create and enter a ResponseStatus variable for the ServiceNowStatus value (e.g., insertRecordResponse).
  4. “插入记录”活动之后添加“写入行”活动。输入以下文本: "Record created: "+insertRecordResponse.Success.ToString+" | sys_id: +sysID (其中sysID是为上述sys_id “值”字段创建的变量)。

测试您的项目

  1. “删除附件”活动之后添加“获取记录”活动。
    • Click the Configure button inside the Insert ServiceNow Record activity.
    • In the Select Object drop-down list, select Attachment.
    • In the sys_id Value field, enter the sys_id variable you created for the Insert Record activity.
    • Click Done.
    • Create and enter a ResponseStatus variable for the ServiceNowStatus value (e.g., getRecordResponse).
  2. 将“IF 条件”活动添加到“获取记录”活动之后。
    • In the Condition property, enter getRecordResponse.Success=False And getRecordResponse.Message.Contains("No Record") to determine if the attachment record was successfully deleted by checking the error message (where getRecordResponse is the variable your created for the ServiceNowStatus property above).
    • In the Then statement box, add a Write Line activity. In the Text property, enter "Test passed: "+getRecordResponse.Message.
    • “写入行”活动后添加“删除 ServiceNow 记录”。
      • Click the Configure button inside the Add Attachment activity.
      • In the Select Object drop-down list, select Incident.
      • In the Id property, enter the sys_id variable you created for the Insert Record activity (e.g., sysID).
      • Create and enter a ResponseStatus variable for the ServiceNowStatus value (e.g., deleteRecordResponse).
    • Add a Write Line activity after the Delete ServiceNow Record activity. In the Text property, enter "Record deleted: "+deleteRecordResponse.Success.ToString.
    • “Else语句”框中,添加“写入行”活动。在“文本”属性中,输入“测试失败: +getRecordResponse.Message ”。
  3. 选择“运行”并验证“输出”窗口是否包括预期的写入行值。

操作完毕!

  • 概述
  • 先决条件
  • 步骤
  • 构建项目
  • 测试您的项目

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新