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

快速入门

在 UiPath 自动化中快速入门使用 Salesforce 活动

概述​

本指南旨在帮助您创建工作示例,以快速验证与 Salesforce 组织的连接,并熟悉所包含的活动输入/输出数据类型。

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

  1. 为 Salesforce 凭据和调用方法创建SecureString变量。
  2. 使用您的SecureString凭据建立与您的 Salesforce 组织的连接( Salesforce 应用程序作用域)
  3. 创建新的 Salesforce 帐户记录(插入记录)。
  4. 将文件上传到您的 Salesforce 组织(上传文件)。
  5. 将上传的文件分配给新的 Salesforce 帐户记录(分配文件)。
  6. 通过输出每个活动的 Salesforce 状态对象() ,验证 插入记录 、 上传文件 和 分配文件 活动的结果。

先决条件​

在开始之前:

  1. 完成 Salesforce设置步骤。
  2. 创建一个新的自动化项目。
    1. 打开 UiPath Studio。

    2. Under New Project, click Process (this opens a New Blank Process window).

    3. Enter a project Name, Location, and Description.

    4. 单击“创建”。

  3. Install the UiPath.Salesforce.Activities package.
    1. In the Design ribbon, click Manage Packages (this opens the Manage Packages window).
    2. Under All Packages, click Official.
    3. In the Search bar, enter Salesforce.
    4. Click, install and accept the license for the UiPath.Salesforce.Activities.
      • 有关 Uipath Studio 包的更多信息,请参阅 Studio 指南中的管理包。

步骤​

构建项目​

“Salesforce 应用程序作用域”活动的使用者密码、密码和安全令牌输入属性需要SecureString数据类型。要获取这些SecureString 数据类型,请在完成String 设置 指南中的 获取凭据 步骤时转换为这些属性存储的 值。

备注:

以下步骤旨在演示如何将String转换为SecureString 。为简单起见,并帮助您快速创建工作示例,转换在项目序列中完成,并要求您输入凭据值作为变量。在创建可共享项目或非示例项目时,不建议这样做。在创建可共享项目或非示例项目时,您可以创建和引用从本地来源(例如.txt 、.xlsx文件),并使用和参数。

将字符串转换为安全字符串​
  1. 创建以下三个变量:
    1. String with your Salesforce login password as the Default value (e.g., Name: textPassword, Default: "UiPath123")
    2. SecureString with New SecureString() as the Default value (e.g., Name: securePassword, Default:New SecureString())
    3. SecureString (e.g., Name: password)
      • For all SecureString variables, select the System.Security.SecurityString type.
    4. 向流程中添加新语句。
    • Recommendation: change the Display Name to "Create SecureString - Password" or something to make it easy to identify its purpose.
  2. 在序列中添加活动。
    1. In the TypeArgument property, select System.Char.
    2. In the Values property, enter the String variable (e.g., textPassword).
  3. 在“遍历循环”活动中,添加“调用方法”活动(“编程”>“执行”>“调用方法”)。
    1. In the TargetObject property, enter your first SecureString variable (e.g., securePassword)
      • Make sure the the TargetType property is (null) (either the TargetObject or TargetType is allowed, not both).
    2. In the MethodName property, enter AppendChar.
      • AppendChar方法用于在字符串后添加 UTF-16 代码单元。
    3. In the Parameters property, add a new parameter using the following values: Direction: In, Type: System.Char, Value: item.
  4. 将该活动添加到“调用方法”活动之后。
    1. In the To property, enter your second SecureString variable (e.g., password).

    2. In the Value property, enter your first SecureString variable (e.g., _securePassword).

  5. 创建以下三个变量:
    1. String with your Consumer Secret as the Default value (e.g., Name: textPassword, Default: "4FA94...")
    2. SecureString with New SecureString() as the Default value (e.g., Name: secureConsumerSeret, Default:New SecureString())
    3. SecureString (e.g., Name: consumerSecret)
      • For all SecureString variables, select the System.Security.SecurityString type.
    4. Repeat steps 2-5 to convert your Consumer Secret String to a SecureString.
  6. 创建以下 3 个变量:
    1. String with your Security Token as the Default value (e.g., Name: textPassword, Default: ""MUc2B...")
    2. SecureString with New SecureString() as the Default value (e.g., Name: secureSecurityToken, Default:New SecureString())
    3. SecureString (e.g., Name: securityToken)
      • For all SecureString variables, select the System.Security.SecurityString type.
    4. Repeat steps 2-5 to convert your Security Token String to a SecureString.

You should now have three Create Secure String sequences in your process, similar to the image below.

Now that you have your SecureString variables, you can add the Salesforce Application Scope activity along with the other Salesforce activities.

添加 Salesforce 活动​
  1. 将“Salesforce 应用程序作用域”活动添加到您的项目中。
    1. 在输入属性值之前,我们来测试您的连接。

      1. Click the Configure button (this opens the connection wizard).
      2. Select your Server (if connecting to, a developer org or non-developer production org- select "Live", a sandbox/test org - select "Test").
      3. Enter your Consumer Key, Consumer Secret, Username, Password, and Security Token (required for developer logins).
      4. Click the Test Connection button and wait for the Connection Successful window.
        • 如果收到错误,请确保您选择了正确的服务器。接下来,尝试按照 设置 指南中 获取凭据 中的最后一步操作重置您的安全令牌,并输入通过电子邮件发送给您的新值。

      5. 连接成功后,您现在可以添加属性值,包括在上述步骤中创建的 SecureString 变量(在连接向导中输入的值独立于属性值,也不共享)。
    2. 输入您在完成 获取凭据 步骤时复制的 使用者密钥 值 ( )。String

    3. In the ConsumerSecret property, enter the second SecureString variable you created in step 6 above (e.g., consumerSecret).

    4. In the Password property, enter the second SecureString variable you created in step 1 above (e.g., password).

    5. Enter your Server value ("Live" or "Test").

    6. 输入您的 Salesforce 登录用户名(例如"name@company.com" )

    7. For the SalesforceConnection property, create and enter a IConnectionService variable (e.g., salesforceConnection).

      • 完成本指南中的步骤时,您不会使用此变量,但最好创建输出变量以在后续活动中使用。

    8. 在“Salesforce 应用程序作用域”活动中添加“插入记录” 活动。

    9. Create a new String variable for this activity's output property (e.g., newAccountID).

    10. Click the Configure button (this opens the Salesforce Object Wizard).

      • 要了解有关向导工作方式的更多信息,请参阅 关于 Salesforce 活动 页面中的“Salesforce 对象向导” 部分。
    11. In the Salesforce Object drop-down list, select Account (the Account ID and Name fields should appear).

    12. In the Add Single Field text box, enter Type and click Enter (you should now have 3 fields).

    13. In the Account ID field, enter the String variable you created in step 1 (e.g., newAcountID).

    14. Enter a Name for the Account (e.g., "Salesforce Quickstart").

    15. Enter a valid Type String (e.g., "Prospect").

      • All fields with a picklist Data Type require a String value that matches an item in the list as shown in the Salesforce user interface.

        • 以“类型”字段为例,默认情况下,选取列表包含下图(来自“Salesforce 帐户”屏幕)所示的值。您可以使用“为标签和值设置格式”活动预览有效的String值(请参见下面的示例)。

      • Click Done.

    16. In the SalesforceOutput property, create and enter a SalesforceStatus variable (e.g., insertRecordStatus).

  2. 在“插入记录” 活动之后添加“上传文件” 活动。
    1. Enter your file Description, FilePath, and Title.

    2. In the OutputID property, create and enter a new String variable (e.g., newFileID).

    3. In the SalesforceStatus property, create and enter a new SalesforceStatus variable (e.g., uploadFileStatus).

  3. 在“获取记录” 活动之后添加“分配文件” 活动。
    1. In the Id property, enter the String variable you created for the Upload File activity (e.g., newFileID).

    2. In the RecordId property, enter the String variable you created for the Insert Activity activity (e.g., newAccountID).

    3. Enter a ShareType value (e.g., "I" for Inferred).

    4. Enter a Visibility value (e.g., "AllUsers").

    5. In the SalesforceStatus property, create and enter a new SalesforceStatus variable (e.g., assignFileStatus).

测试您的项目​

  1. 要验证您的记录是否已插入、文件已上传并分配给插入的记录,请在“分配文件”活动之后添加 3个活动。

    1. In the first Write Line activity, enter the following Text: "Insert Record Success: "+insertRecordStatus.Success.ToString.

      • insertRecordStatus is the SalesforceStatus variable you created for the Insert Record activity.
    2. In the second Write Line activity, enter the following Text: "Upload File Success: "+uploadFileSuccess.Success.ToString.

      • uploadFileStatus is the SalesforceStatus variable you created for the Upload File activity.
    3. In the third Write Line activity, enter the following Text: "Upload File Success: "+assignFileSuccess.Success.ToString.

      • assignFileStatus is the SalesforceStatus variable you created for the Assign File activity.
    4. Click Start and verify the results in the output window.

  2. To further verify your results, login to your Salesforce Org and go to your Accounts and Files to see your new additions.

操作完毕!您现在拥有一个包含 Salesforce 活动的自动化项目。要了解有关 Salesforce 活动的更多信息,请参阅活动以获取指向活动详细信息页面的链接。

要进一步实现 Salesforce 自动化,请参阅UiPath Connector for Salesforce文档。UiPath 连接器 for Salesforce 在 Salesforce 和 UiPath Orchestrator(内部部署或云实例)之间创建“服务器 - 服务器”连接。您可以使用该工具通过流构建器、流程构建器或工作流提交 UiPath 作业或从 Salesforce 添加队列项目。

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

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新