activities
latest
false
UiPath logo, featuring letters U and I in white
Classic Integrations Activities
Last updated Nov 8, 2024

Quickstart

Overview

The purpose of this guide is to help you create a working sample to quickly verify the connection to your Salesforce Org and get familiar with the included activities input/output datatypes.

After completing the steps in this guide, you'll have an automation sequence that does the following:

  1. Creates SecureString variables for your Salesforce credentials and Invoke Method.
  2. Establishes a connection to your Salesforce Org using your SecureString credentials (Salesforce Application Scope)
  3. Creates a new Salesforce account record (Insert Record).
  4. Uploads a file to your Salesforce Org (Upload File).
  5. Assigns the uploaded file to your new Salesforce account record (Assign File).
  6. Verifies the results of the Insert Record, Upload File, and Assign File activities by outputting each of their SalesforceStatus objects ().

Prerequisites

Before you begin:

  1. Complete the Salesforce Setup steps.
  2. Create a new automation project.

    1. Open UiPath Studio.
    2. Under New Project, click Process (this opens a New Blank Process window).
    3. Enter a project Name, Location, and Description.
    4. Click Create.



  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.

      • For more information about Uipath Studio packages, see Managing Packages in the Studio Guide.



Steps

Build your project
The Salesforce Application Scope activity requires SecureString datatypes for the Consumer Secret, Password, and SecurityToken input properties. To get these SecureString datatypes, you convert the String values you stored for these properties when completing the Get your credentials steps in the Setup guide.
Note:
The steps below are intended to demonstrate how you can convert a String to a SecureString. For simplicity and to help you quickly create working sample, the conversion is done within your project sequence and requires you to enter your credential values as variables. This is not recommended when creating shareable or non-example projects.

When creating shareable or non-example projects, you can create and reference external workflows that get your Consumer Secret, Password, and SecurityToken from a local source (e.g., .txt, .xlsx files) and perform the conversion using <in> and <out> arguments.

Convert Strings to SecureStrings

  1. Create the following three variables:

    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. Add a new statement to the process.
    • Recommendation: change the Display Name to "Create SecureString - Password" or something to make it easy to identify its purpose.
  2. Add a activity inside the Sequence.

    1. In the TypeArgument property, select System.Char.
    2. In the Values property, enter the String variable (e.g., textPassword).
  3. In the For Each activity, add the InvokeMethod activity (Programming > Execute > InvokeMethod).

    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.

      • The AppendChar method is used to add a UTF-16 code unit after the string.
    3. In the Parameters property, add a new parameter using the following values: Direction: In, Type: System.Char, Value: item.
  4. Add the activity after the InvokeMethod activity.

    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. Create the following three variables:

    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. Create the following, 3 variables:

    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.

Add the Salesforce activities

  1. Add the Salesforce Application Scope activity to your project.

    1. Before you enter your property values, let's test your connection.

      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.

        • If you receive an error, make sure that you selected the correct Server. Next, try resetting your Security Token by following the last step in the Get your credentials in the Setup guide and enter the new value that's emailed to you.



      5. After a successful connection, you can now add your property values, including the SecureString variables you created in the steps above (the values entered in the connection wizard are independent of the property values and not shared).
    2. Enter your ConsumerKey value (String) that you copied when completing the Get your credentials steps.
    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. Enter your Salesforce login Username (e.g., "[email protected]")
    7. For the SalesforceConnection property, create and enter a IConnectionService variable (e.g., salesforceConnection).
      • You will not use this variable when completing the steps in this guide, but it's good practice to create your output variables for use in subsequent activities.



    8. Add the Insert Record activity in the Salesforce Application Scope activity.
    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).

      • To learn more about how the wizard works, see the Salesforce Object Wizard section in the About the Salesforce Activities page.
    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.
        • Using the Type field as an example, by default the picklist includes the values shown in image below (from the Salesforce Account screen). You can use the Format Labels And Values activity to preview the valid String values (see example below).


      • Click Done.



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


  2. Add the Upload File activity after the Insert Record activity.

    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. Add the Assign File activity after the Get Record activity.

    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).


Test your project
  1. To verify that your record was inserted, file uploaded and assigned to the inserted record, add 3 activities after the Assign File activity.

    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.





You're done! You now have an automation project that includes Salesforce activities. To learn more about the Salesforce activities, see Activities for links to the activity detail pages.

To further your Salesforce automation, see the UiPath Connector for Salesforce documentation. The UiPath Connector for Salesforce creates a “server – server” connection between Salesforce and UiPath Orchestrator (on-prem or Cloud instances). It gives you the ability to submit UiPath Jobs or add Queue items from Salesforce via Flow Builder, Process Builder, or Workflow.

  • Overview
  • Prerequisites
  • Steps

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.