活动
最新
False
横幅背景图像
Integration Service 活动
上次更新日期 2024年4月23日

对象和附件

概述

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

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

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

  1. 与 ServiceNow 实例建立连接。
  2. 创建新的 ServiceNow 事件 (插入记录)。
  3. Retrieves the record and outputs the expected error message (Get Record, If).
  4. 删除已创建的事件 (删除记录)。

先决条件

在开始之前:

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

步骤

构建项目
  1. Follow the steps described in the Connector documentation to establish a connection.
  2. Add the ServiceNow Scope activity. Click the Configure button, select and test the desired connection, then click Save.
  3. 在“ ServiceNow 作用域 ”活动中添加该活动。

    • 单击“ 插入 ServiceNow 记录” 活动中的“配置”按钮。
    • 在“ 选择对象 ” 下拉列表中,选择 “事件”
    • sys_id 创建并输入 String 变量(例如 sysID
    • 使用“ 添加单个字段 ” 文本框输入 short_description。 输入 short_description (例如, “UiPath-Attachment”)。
    • 单击“完成”
    • ServiceNowStatus 值创建并输入 ResponseStatus 变量(例如, insertRecordResponse)。
  4. Add a Write Line activity after the Insert Record activity. Enter the following Text: "Record created: "+insertRecordResponse.Success.ToString+" | sys_id: "+sysID (where sysID is the variable created for the sys_id Value field above).
测试您的项目
  1. 在“ 删除附件 ”活动之后添加该活动。

    • 单击“ 插入 ServiceNow 记录” 活动中的“配置”按钮。
    • 在“ 选择对象 ” 下拉列表中,选择“ 附件”。
    • 在“ sys_id ”字段中,输入您为“ 插入记录” 活动创建的sys_id变量。
    • 单击“完成”
    • ServiceNowStatus 值创建并输入 ResponseStatus 变量(例如, getRecordResponse)。
  2. Add an If activity after the Get Record activity.

    • 在“ 条件” 属性中,输入 getRecordResponse.Success=False 和 getRecordResponse.Message.Contains("No Record") ,以通过检查错误消息来确定是否已成功删除附件记录(其中, getRecordResponse 是您为上面的 ServiceNowStatus 属性创建的变量)。
    • 在“ Then 语句”框中,添加“ 写入行 ”活动。 在“ 文本 ”属性中,输入 “测试已通过:”+getRecordResponse.Message
    • 写入行 活动之后添加。

      • 单击“ 添加附件 ”活动中的“配置”按钮。
      • 在“ 选择对象 ” 下拉列表中,选择 “事件”
      • 在“ Id ” 属性中,输入您为“ 插入记录” 活动创建的sys_id变量(例如, sysID)。
      • ServiceNowStatus 值创建并输入 ResponseStatus 变量(例如, deleteRecordResponse)。
    • 在“ 删除 ServiceNow 记录” 活动之后添加“写入行”活动。 在“ 文本 ” 属性中,输入 “已删除记录:”+deleteRecordResponse.Success.ToString
    • 在“ Else 语句”框中,添加“ 写入行 ”活动。 在“ 文本 ” 属性中,输入 “测试失败:”+getRecordResponse.Message
  3. 单击 “运行” 并验证“ 输出 ”窗口是否包含预期的写入行值。

操作完毕!

要了解有关 ServiceNow 活动的更多信息,请参阅“ 活动 ”页面以获取完整的活动列表以及指向活动详细信息页面的链接。

  • 概述
  • 先决条件
  • 步骤

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.