Automation Champion

Automating Salesforce One Click at a Time
Automation Champion
  • Home
  • About Me
    • Testimonials
    • Resources
  • Process Builder
  • Salesforce Flow
  • Pardot
  • Apex
  • Training Details
    • Salesforce Administrator
    • Salesforce Advanced Administrator
    • Platform App Builder
    • Lightning Flow
    • Pardot
    • Sales Cloud
    • Service Cloud
    • Community Cloud
    • Hands-on Excercises
  • My Books
  • Contact Me
  • Tag: PartnerNetworkRecordConnection

    • Getting Started with Process Builder – Part 10 (Auto forward Records to a Connection)

      Posted at 1:07 PM by Rakesh Gupta, on March 13, 2015

      Big Idea or Enduring Question:

      Salesforce-to-Salesforce is a natively supported feature of the Salesforce Platform and easily enables two dealing partners to share relevant data records in real-time. It allows you to share records with your business partners that use Salesforce and get real-time updates on the shared data. For example, you can share Opportunity and Lead data with business partners.

      One key pain point in the Salesforce-to-Salesforce connection is sharing data manually. If you want to automate the data sharing process, then you have to use the Apex code. In this case, we’re able to accomplish this with a couple of declarative tools and no coding required. 

      (Please note that Salesforce to Salesforce Connections is only available in Classic at this time. We’re not sure if Salesforce plans to support this in lightning. We can switch to classic to set up the connection for this tutorial.)

      Objectives:

      After reading this blog post, the reader will be able to:

      • Understand the Salesforce-to-Salesforce connection capabilities
      • Understand which options are available for sharing records with partners
      • Share data seamlessly with automation
      • Get exposure to Lightning Flow

      Business Use Case

      Martin Jones is working as a System administrator at Universal Containers (UC). His company as well as another company (Acme Corp), has established Salesforce-to-Salesforce. He’s required to share all opportunities that didn’t originate from the “web” lead source. Considering the volume of opportunities, Martin needs to automate this.

      Automation Champion Approach (I-do):

      There are multiple solutions possible for the above business scenario. We will use Flow and Process Builder to solve the above business requirement. Before proceeding you have to understand the below-mentioned objects in Salesforce

      • PartnerNetworkConnection: -This object represents a Salesforce to Salesforce connection between Salesforce organizations.
      • PartnerNetworkRecordConnection: – This object represents a record shared between Salesforce organizations using Salesforce to Salesforce.

      If you haven’t enabled Salesforce-to-Salesforce connection and want to do so, then please have a look at An Introduction to Salesforce to Salesforce article published by Salesforce. In this tutorial, we’re going to set up a Salesforce to Salesforce connection with a fictitious company, Acme. To set this up, please follow the instructions listed here.

      This article will help you to understand how to auto-forward records to a Connection and how to launch a Flow from Process Builder. If you’re unfamiliar with the flow and its capabilities, I’d recommend checking out our tutorials on Flow listed here.  

      Before discussing it, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes to go through the following Flow diagram and understand it.

      Let’s begin building this automation process.

      Guided Practice (We-do):

      There are 4 steps to solve Martin’s business requirement using Flow and Process Builder. We must: 

      1. Find partner network connection Id
      2. Creating a custom label to store opportunity id
      3. Lightning Flow Steps:
        1. Define flow properties for auto-launched flow
        2. Add a text variable to store an opportunity record data
        3. Add a create records element  – share the record with the auditor 
      4. Process Builder Steps:
        1. Define process properties
        2. Define evaluation criteria
        3. Define process criteria
        4. Add action – flows 

      Step 1: Find Partner Network Connection Id for Acme Corp  

      The first step is to find out the Connection Id for partner network Acme Corp. One possible workaround is to use the Developer Console. 

      1. Click Setup | Developer Console 
      2. In the Query Editor, run the following SOQL query 
        1. select ConnectionName, Id from PartnerNetworkConnection where ConnectionStatus=’Accepted’
      3. Make sure to copy Connection Id. 

      SOQL Query - To get Partner Network Connection Id  

      Step 2: Creating a Custom Label 

      Create one custom label to store the ID of the connection a record is shared with. 

      1. Click Setup.
      2. In the User Interface, type Custom Labels.
      3. Click on the New Custom Label button.
      4. Enter Short Description the Name will auto-populate. 
      5. Now enter the Acme Corp Connection Id in the Value.
      6. Click Save.

      Step 3.1: Lightning Flow – Define Flow Properties 

      1. Click Setup.
      2. In the Quick Find box, type Flows.
      3. Select Flows then click on the New Flow.
      4. Select the Autolaunched Flow (No Trigger) option and click on Next and configure the flow as follows: 
        1. How do you want to start building: Freeform
      5. Click Done.

      Step 3.2: Lightning Flow – Add a Text Variable to Store Opportunity Id

      1. Under Toolbox, select Manager, then click New Resource to store Opportunity Id.
      2. Input the following information: 
        1. Resource Type: Variable
        2. API Name: varTOpportunityId
        3. Data Type: Text
        4. Default Value: {!GlobalConstant.EmptyString}
        5. Check Available for Input
        6. Check Available for Output
      3. Click Done.

          

      Step 3.3: Lightning Flow – Create Records – Forward Opportunity Record to Acme Corp 

      The next step is to auto-share the Opportunity records with Partner connection. For this, we will use the Create Records element. We’ll essentially duplicate our current record into the established connection org by pointing our record to a new record in the connected Salesforce instance.

      1. Under Toolbox, select Elements. Drag and drop Create Records onto the canvas. 
      2. Input the following information:
        1. Enter Label the API Name will auto-populate.
        2. How Many Records to Create: One
        3. How to Set the Record Fields: Use separate resources, and literal values
        4. Object: Connection History
        5. Set Field Values for the Connection History
        6. Row 1:
          1. Field: ConnectionId
          2. Value: {!$Label.Acme_Corp_Connection_Id}
        7. Click Add Row
        8. Row 2:
          1. Field: LocalRecordId
          2. Value: {!varTOpportunityId}
      3. Click Done.

      In the end, Martin’s Flow will look like the following screenshot:

      Once everything looks good, perform the steps below: 

      1. Click Save.
      2. Enter Flow Label the API Name will auto-populate.
      3. Click Show Advanced.
      4. API Version for Running the Flow: 50
      5. Interview Label: Auto Forward Record to Connection {!$Flow.CurrentDateTime}
      6. Click Save. 

      Almost there! Once everything looks good, click the Activate button.  

      Our next task is to create a Process on the Opportunity object to launch a Flow, only when an Opportunity Lead Source is not equal to the Web. 

      Step 4.1: Define Process Properties

      1. Click Setup.
      2. In the Quick Find box, type Process Builder.
      3. Select Process Builder, then click New.
      4. Name the Process and click the Tab button. The API Name will populate. 
      5. As a best practice, always input a description. 
      6. The process starts when A record changes.
      7. Click Save.

      Define Process Properties

      Step 4.2: Define Evaluation Criteria

      1. Click on the Add Object node to begin selecting the evaluation criteria.
      2. Select the Opportunity object from the dropdown list.
      3. Start the process only when a record is created.
      4. Click Save.

      Evaluation Criteria

      Step 4.3: Define Process Criteria

      1. Click the Add Criteria node to begin defining the process criteria.
      2. Name the criteria.
      3. The criteria should execute actions when the conditions are met.
      4. Set Conditions
        1. Row 1
          1. Field: Opportunity| LeadSource
          2. Operator: Does not equal
          3. Type: Picklist
          4. Value: Web
      5. Select All of the conditions are met (AND). 
      6. Click Save.

      Step 4.4: Add Action – Flow

      1. Below Immediate Actions, click Add Action.
      2. For Action Type, select Flows. 
      3. Name the action.
      4. Select the flow we just created – Auto Forward Record to Connection.
      5. Set Flow Variables: 
        1. Row 1:
          1. Flow Variable: varTOpportunityId
          2. Type: Field Reference
          3. Value: Opportunity | Id
      6. Click Save.

      In the end, Martin’s Process will look like the following screenshot:

      Almost there! Once everything looks good, click the Activate button. 

      Proof of Concept

      Now onwards, if a business user creates a new Opportunity record with Lead Source other than the Web, then Process Builder will automatically share it with Partner Network Connection Acme Corp.

      1. Now create a new Opportunity with the Name Burlington Textiles Weaving Plant Generator – Second Phase and Lead Source blank. Then check the External Sharing related list available on the Opportunity Detail page, as shown in the following screenshot:Auto Share Opportunity with Connection
      2. Process Builder automatically shared the new Opportunity with partner network connection Acme Corp. 

      Formative Assessment:

      Identify a custom object in your org that should be shared based on the settings in a related object and create an autolaunched flow that will share the records without actual manual sharing

      Post a picture of the sharing on Twitter @automationchamp, #AutomatedSharingwithFlow

      Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

      Posted in Process Builder, Sales cloud, Salesforce Flow, Spring'15 Release | 17 Comments | Tagged Add Criteria Proces builder, and any time it’s edited to subsequently meet criteria in Proces builder, auto accept records from conenction, Auto forward Record to a Connection, Auto forward Records to a Connection, Auto send records to a connection, ConnectionStatus, Do you want to execute the actions only when specified changes are made to the record, Enable Process Builder, FOrwatd record to Connection Salesforce, Getting started with Process Builder, How to activate Process builder, how to use Process builder, Introduction to Salesforce to Salesforce, Launch flow from PB, Lightning App, Lightning Developer Week, Lightning Process builder, PartnerNetworkConnection, PartnerNetworkRecordConnection, Prcoess builder and Chatter use case, Process Builder, Process Builder action, Process Builder example, Process Builder Salesforce, Process Builder update a record action, Process builder use case, Process management, salesforce, Salesforce Lightning, Salesforce to Salesforce, setup Salesforce-toSalesforce, Spring15 Process builder enhancement, Update Records, Use Process builder to aut forward records to connection, What is Process Builder, Whenever a record is created
    • Search

    • Upcoming Trainings

      Salesforce Administrator Certification
      Salesforce Advanced Administrator Certification
      Salesforce Platform App Builder Certification
      Lightning Flow & Process Builder
      Pardot Specialist & Consultant Certification
      Sales Cloud Consultant Certification
      Service Cloud Consultant Certification
      Community Cloud Consultant Certification
    • Sponsor #1

    • Sponsor #2

    • Sponsor #3

    • Sponsor #4

    • Order Now!

    • Buy My Book

    • Buy My Book

    • Recent Posts

      • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record with the Help of Salesforce Flow)
      • Getting Started with Salesforce Flow – Part 54 (Auto-follow a Chatter Question After Reply)
      • Getting Started with Salesforce Flow – Part 53 (Clone a User with their associated Public Group, Queue Membership and Permission Sets)
      • Getting Started with Pardot – Part 14 (How to Use Pardot Form Handlers)
      • Getting Started with Salesforce Flow – Part 51 (Add a Flow to a Lightning Page)
    • Salesforce ID Converter Build on Lightning Flow

      Converting 15 digit ID to 18 digit Salesforce ID
    • Blog Archives

    • Categories

  • Information

    • About Me
    • Affiliate Disclaimer
    • Contact Me
    • Privacy Policy
  • Top Posts

    • Salesforce Spring’21 Release Quick Summary
    • Learning Flow
    • Getting Started with Salesforce Flow – Part 53 (Clone a User with their associated Public Group, Queue Membership and Permission Sets)
    • Top Ten Gems of Salesforce Lightning Experience Spring’21 Release!
    • Learning Process Builder
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record with the Help of Salesforce Flow)
    • Getting Started with Process Builder – Part 30 (Auto-generate Renewal Opportunity With Line Items)
    • Getting Started with Salesforce Flow – Part 33 (Prior Value of a Record in Record-Triggered Flows)
    • Learning Pardot
  • Social Media

    • View Automationchampion’s profile on Facebook
    • View Automationchamp’s profile on Twitter
    • View Rakeshistom’s profile on GitHub