---
schema_version: "1"
id: d50bdcf25bc77bd2cacc53f5d9c64a6b076e107b8174c3bca15a5dfc9d3d4126
title: B2B Referral Management Flows
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/pc_b2bref_flow.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.pc_b2bref_flow.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 7e54937eb9a7b70549227923567a0a0b76920b9f1e31bb9960ad7e0b05714a2d
description: B2B Referral Management uses flows to automate the tracking of referrals and rewards throughout the lead and opportunity lifecycles. These flows handle event processing when leads are created or converted and when referred opportunities are won.
products:
  - Partner Cloud
  - Cross Cloud
release: "264"
---
# B2B Referral Management Flows

B2B Referral Management uses flows to automate the tracking of referrals and rewards throughout the lead and opportunity lifecycles. These flows handle event processing when leads are created or converted and when referred opportunities are won.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Sales Cloud Enterprise Edition (or above) with Partner Ecosystem Management (Member or Login), Partner Community, and External Apps licenses.</td></tr></tbody></table>

B2B Referral Management includes these flows:

- **Process Opportunity Won Referral Event:** Updates referral and reward records when an opportunity is closed as won.
- **Process Partner Referral Code:** Processes referral codes for new or converted leads.

## Process Opportunity Won Referral Event

The Process Opportunity Won Referral Event flow (API Name: `partner_b2brfrmgt__ProcOpptyWonRefEvt`) triggers when an Opportunity record is created or updated. It calls an invocable action to create and update referral and reward records when a referred Opportunity is won.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small "><colgroup><col style="width:33.33333333333333%"> <col style="width:33.33333333333333%"> <col style="width:33.33333333333333%"></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Element Label</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">API Name</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Description</td></tr><tr class=""><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;"><strong>Process B2B Closure Event</strong></td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">ProcessB2BClosureEvent</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Action element. Processes a B2B referral event of type Closure by calling an action and passing in the referral code, account ID, current date and time from the triggering Opportunity record.</td></tr><tr class=""><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;"><strong>Get Referral Record</strong></td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">GetReferralRecord</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Get Records element. Gets the referral record with an OpportunityId that matches the ID of the triggering opportunity.</td></tr><tr class=""><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">&nbsp;</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">&nbsp;</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">&nbsp;</td></tr><tr class=""><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;"><strong>Update Extended Reward</strong></td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">UpdateExtendedReward</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Update Records element. Updates the Extended Reward record with an AccountId that matches the ReferrerId of the Referral from the GetReferralRecord record variable.</td></tr><tr class=""><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">&nbsp;</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">&nbsp;</td><td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">&nbsp;</td></tr></tbody></table>

## Process Partner Referral Code

The Process Partner Referral Code flow (API Name: `partner_b2brfrmgt__ProcPartnerRefCode`) processes the referral code for lead records with a Lead Source of Partner when they are created or updated.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small "><colgroup><col style="width:33.33333333333333%"> <col style="width:33.33333333333333%"> <col style="width:33.33333333333333%"></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Element Label</td><td class="slds-cell-wrap" style="vertical-align:top;">API Name</td><td class="slds-cell-wrap" style="vertical-align:top;">Description</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><strong>Check Lead Status</strong></td><td class="slds-cell-wrap" style="vertical-align:top;">LeadStatusCheck</td><td class="slds-cell-wrap" style="vertical-align:top;">Decision element. Evaluates whether the Lead is New or Converted and directs it to the appropriate path.</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><strong>Process B2B Converted Event</strong></td><td class="slds-cell-wrap" style="vertical-align:top;">ProcessB2BConvertedEvent</td><td class="slds-cell-wrap" style="vertical-align:top;">Action element. Uses values from earlier in the flow to set the inputs for the "Process B2B Referral Event" core action.</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><strong>Process B2B Referral Event</strong></td><td class="slds-cell-wrap" style="vertical-align:top;">ProcessB2BReferralEvent</td><td class="slds-cell-wrap" style="vertical-align:top;">Action element. Sets the inputs for the "Process B2B Referral Event" core action using values from earlier in the flow.</td></tr></tbody></table>