Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Referral Event

Create referral event records when an advocate refers a friend, or when referred friends sign up or make a purchase.

This action is available in API version 64.0 and later.

Supported REST HTTP Methods

URI
/services/data/vXX.X/actions/standard/processB2bReferralEvent
Formats
JSON
HTTP Methods
POST
Authentication
Authorization: Bearer Token

Inputs

Input Details
event​Type
Type
String
Description
Required. The type of event that the referral completed. Possible values are:
  • Refer
  • Enrollment
  • Purchase
referral​Code
Type
String
Description
Required. The referral code used by a referral to sign up as a customer, or to make a purchase. The referral code is a combination of the advocate’s referral code and the promotion code separated by a hyphen.
activity​Date​Time
Type
DateTime
Description
The date and time when the referral event took place.
account​Id
Type
String
Description
ID of the account who is being referred.
lead​Id
Type
String
Description
ID of the lead record that is used to identify referred members.
opportunity
Type
String
Description
Opportunity record associated with the referral.
product​Id
Type
String
Description
The ID of the product that the referral purchased.
purchase​Amount
Type
String
Description
The amount the referral spent to purchase one or more units of a product.
purchase​Quantity
Type
String
Description
The number of units that the referral purchased of a product.

Outputs

Output Details
account​Id
Type
String
Description
ID of the account that is associated as a referral program member.
referral​Id
Type
String
Description
The ID of the referral record of the person who was referred, or whose referral event is processed.
lead​Id
Type
String
Description
ID of the lead record that is used to identify referred members.
referral​Stage
Type
String
Description
The current stage of the referral promotion for a referral. Possible values are:
  • Promotion Launched
  • Advocate Joins Promotion
  • Advocate Refers Friend
  • Friend Signs Up
  • Friend Completes First Purchase
transaction​Journal​Ids
Type
String
Description
The comma separate list of transaction journal IDs created to process the referral event.
voucher​List
Type
String
Description
The details of the voucher records created for the referral event.
custom​Reward​List
Type
String
Description
The details of the custom reward records created for the referral event.

Example

Sample Request

1{
2   "inputs":[
3      {
4         "accountId": "001xx000003Ge9HAAS",
5  "activityDateTime": "2025-02-13T00:00:00",
6  "referralCode": "FR886GFJ-NONMCB2B",
7  "eventType": "Refer",
8  "purchaseAmount": 40000,
9  "purchaseQuantity": 34
10 }
11 ]
12}

Sample Response

1
2    {
3        "actionName": "processB2bReferralEvent",
4        "errors": null,
5        "invocationId": null,
6        "isSuccess": true,
7        "outcome": null,
8        "outputValues": {
9            "accountId": "001xx000003Ge9HAAS",
10            "opportunityId": "006xx000001a3e8",
11            "voucherList": [
12                {
13                    "effectiveDate": "2025-06-26T00:00:00.000Z",
14                    "expirationDate": "2026-06-30T00:00:00.000Z",
15                    "transactionJournalId": "0lVxx00000003Fd",
16                    "voucherCode": "Z41TNEH9",
17                    "voucherDefinition": "vdef",
18                    "voucherId": "0kDxx00000000xhEAA"
19                },
20                {
21                    "effectiveDate": "2025-06-26T00:00:00.000Z",
22                    "expirationDate": "2026-06-30T00:00:00.000Z",
23                    "transactionJournalId": "0lVxx00000003Fe",
24                    "voucherCode": "YTARIRO3",
25                    "voucherDefinition": "vdef",
26                    "voucherId": "0kDxx00000000xiEAA"
27                }
28            ],
29            "transactionJournalIds": [
30                "0lVxx00000003Fd",
31                "0lVxx00000003Fe"
32            ],
33            "referralStage": "Referral Closure/Converts",
34            "referralId": "0wixx00000000b7",
35            "extendedRewardList": [],
36            "leadId": "00Qxx000002TSFi"
37        },
38        "sortOrder": -1,
39        "version": 1
40    }
41]