Salesforce Sales Cloud Integration with Zinrelo
This document will guide you through the Salesforce Sales Cloud integration.
This document is for Salesforce Sales Cloud installation. After this, you need to sync your Salesforce Sales Cloud account with SFMC; for more details, click here.
Installation Process
You need to install the "package" of Salesforce into your organization. A managed package is a collection of components and applications that make the connection between your Salesforce Sales Cloud and Marketing Cloud accounts work.
Follow along with these steps to download the latest version of the managed package.
- Use the given URL to install the package in any organization:
https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5g0000002d86
Note: If you are installing in a sandbox organization, change the first part of the URL to http://test.salesforce.com.
- Use your admin credentials to log in to your Salesforce account, and then click "Install for All Users."

- Tick the acknowledgement box and then press the "Install" button.
- Wait for the installation to complete. And then click on "Done."


Register Salesforce Site Domain
Things to consider while setting up Salesforce sites:
- Your company's Salesforce Sites domain is used for all the sites that you create.
- To make public websites and apps that work directly with your Salesforce.com organization, you must register the domain for your company's Salesforce site.
- Your Salesforce site domain must be unique, such as your company's name or a variation of your company's name, ex. "mycompanyportalname."
Let's begin.
- Click on "Setup."
- In "Quick Search," find "Sites" and click.

- Tick "Site Terms of Use" and click on "Register my Salesforce Site Domain."

- Click on “New.”

- Fill up the details for your site.
Make sure you add "Site Label" and "Site Name," the same as given in the screenshot.
Note: You can enable other settings as per your requirements.
- Activate your site domain when you’re ready to make your site available to the public. Click on the "Activate" button.

Note: You can activate or deactivate your Salesforce site by clicking the "Activate" or "Deactivate" button in the Action column.

Note: If you already have a registered site, you do not need to create a new one. You can use the same registered domain for your organization.
Enable the Zinrelo Webhook for Salesforce
Once you are done with site hosting, login to the Zinrelo portal for webhook settings.
Login to Zinrelo Site >> Notification Tab >> Go to Webhooks >> Select Settings >> Enter the webhook URL.

For checking the domain name & path in salesforce Go To Setup >> Quick Find Box >> Sites >> Custom URLs

The webhook url should be like-
https://Domain Name/Path/services/apexrest/Zinrelo/HandleZinreloEvents.
In which, “services/apexrest/Zinrelo/HandleZinreloEvents” has to be static, while the domain name and path have to be updated.
- Domain Name - Copy the same domain name that you just created in salesforce.
- Path - This is optional if not given as shown in below fig.
Give Access to Apex Classes
In Salesforce, Apex classes are used to implement the actions associated with an object. It is to give permission to objects, fields, users, tab settings, app settings, Apex class access, Visualforce page access, page layouts, record types, login hours, and login IP ranges.
Note: You will need to ensure Apex classes are included for the login user. Otherwise, this can cause an error like "You don’t have apex class permission."
To grant access to Apex Classes, follow the given steps:
- Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label."

- Click on "Public Access Settings."

- Click on "Apex Class Access."

- Click on "Edit" >> Select the classes >> click on Add >> Save
Classes need to be included:
- HandleZinreloEventsRestController
- HandleZinreloEventsWrapper
- ZinreloFLS
- HandleZinreloEventsRestControllerTest
- ZinreloFLS_Test
Give Access to Objects
A permission is required to grant access to edit the fields within members, contacts and ZinreloDebugLogs objects. Follow the given steps to give access to the objects.
Member access
- Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label." >> Click on "Public Access Setting" >> Click on "Object Settings."

[If you are unable to see the following UI, then please follow these steps:
Go to "Setup" >> Search "User Management Settings" >> Enabled "Enhanced Profile User Interface" >> Return to your first step]

- Select the "Member" object.

- Click on the members to edit the object.
- Click on the "edit" button.

- Enable Object Permission and check the boxes for the associated fields before saving.

Contact access
- Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label." >> Select "Public Access Setting" >> Click on "Object Settings."

- Select the "Contacts" object.

- Click on the contacts to edit the object.
- Click on the "edit" button.
- Enable Object Permission and check the boxes for the associated fields before saving.

ZinreloDebugLogs access
- Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label." >> Click on "Public Access Setting" >> Click on "Object Settings."

- Select the "ZinreloDebugLogs" object.

- Click on the contacts to edit the object.
- Click on the "edit" button.
- Enable Object Permission and check the boxes for the associated fields before saving.

Give System Permissions
- Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label." >> Click on "Public Access Setting" >> Click on "System Permissions."
- Click on the "Edit" button.

- Give permissions to Apex REST Services, API Enabled & View All Custom Settings.
Configure Zinrelo Keys and Events in Salesforce
To begin with configuring Zinrelo keys and events in Salesforce, open "All Custom Metadata Type" in Salesforce.
Go to "Setup" >> in the Quick Find Box search "Custom Metadata Types" >> Click on it

Configure Zinrelo keys
Step 1: Click on the label "Zinrelo Keys."
Step 2: Click on the "Manage Zinrelo Keys" or "Manage Records" button.

Step 3: Click on "New."

Note: Record name should be Zinrelo.
Step 4: Update the value as per the given table:
Label | Zinrelo |
---|---|
Zinrelo Keys Name | Zinrelo |
Create Debug for Success | [ ] |
Insert New Zinrelo Member and Contact | ☑ |
Unique Identifier for Zinrelo Member | Insert Contact field API Name [or FIELD NAME] |
HMAC Secret Key | Copy from Zinrelo Site |
Description of each values:
- If the Create Debug for Success checkbox is checked, the debug for success operation will be visible.
- If the Insert New Zinrelo Member and Contact checkbox is checked, a new member and contact record will be added to salesforce.
- In the Unique Identifier for Zinrelo Members, we can insert any one contact field API name. [Go to "Contact object" >> Select FIELD NAME and paste here in record.]
Note: Select any field except "Lookup" data type. We recommend to select email, phone number or member ID as a Unique Identifier.
- HMAC Secret Key: You can get this secret key from the Zinrelo site by following the below steps:
- Login now to Zinrelo portal.
- Go to Zinrelo Site >> Expand Notification Tab >> Go To Webhooks >> Click on Settings >>Secret Key shown in below figure.

- Copy same Secret Key from site and paste in HMAC Secret Key field.
- Click on "Save."
Configure Zinrelo event type
Step 1: Click on the label "Zinrelo Event Types."

Step 2: Click on "Manage Zinrelo Event Types" or Manage record button.

Step 3: Click on "New."

Step 4: Click on the "Edit" button and fill in the following values:
Label | Zinrelo Events |
---|---|
Zinrelo Event Types Name | Zinrelo_Events |
Event Referral Link Share | event_referral_link_share |
Friend Incentive Request | event_friend_incentive_request |
Member Enrollment | event_member_enrol |
Member Tier Downgraded | event_member_tierdowngrade |
Member Tier Upgraded | event_member_tierupgrade |
Member Updated | event_member_update |
Points Awarded | event_points_earned |
Points Deducted | event_points_deducted |
Points Expired | event_points_expired |
Points Redeemed | event_points_redeemed |
Referral Success | event_referral_success |
Campaign Entered | event_campaign_entered |
Campaign Exited | event_campaign_exited |

Note: The value should be passed as given in the table to allow the system to work efficiently.
Step 5: Click on "Save."
How to create ZinreloDebugLogs
Step 1: In Quick Search, search "Tabs" and click on it.

Step 2: Click on the "New" button.
Step 3: Enter the details.
- Select "ZinreloDebugLogs" from the object dropdown.
- Select the tab style.
- Click on the "Next" button.

Step 4: Click on the "Next" button.

Step 5: Then, click on the "Save" button.
Note: You will find ZinreloDebugLogs in the nine dots next to the Home button.

Create Formula Field
A formula field is created to bring data from the member custom object to the contact object. It is necessary to have a relationship between the member custom object and contact objects.
We need to bring to the contact object updated while the events happened, for example, points redeemed, points expired. For these events, we are creating a formula field on the contact account that will sync data to SFMC.
These fields can be called out in emails to get the members' data. For example, you can create a formula field called "Available Points" and call out this field in emails to have the data of available points for each member.
Also, when the contact record is updated, that checkbox will be true and immediately false. This will limit data sync to SFMC, i.e., only required data will get synced.
Follow the given steps for creating the formula field:
- Click the gear icon and select "Setup."

- Click on "object manager" and select "Contact object."

- Select "Fields & Relationships" and click on "New."

- Select "Formula" as the data type and click "Next."

- Give the field's name and label, and select the formula return type. And click "Next."

- Click on "Advanced Formula" and then "Insert Field."

- Insert your formula field value, which will evaluate and return the result to the formula field. Select "Contact >" then "Member >" and the formula field you created.


- Click "Next," select "Visibility," and click "Next."

- Select the page layout where the field should be included. And click "Save."
- A formula field is created.


Note: Salesforce has strict limits on the number of fields that you can customize. A Developer Edition organization, for example, can have up to 500 custom fields, whereas Unlimited and Performance organizations can have up to 800 total custom fields.
Member fields you can create in Salesforce
Member Object | Fields |
---|---|
Member Profile | -Member ID -First Name -Last Name -Address -Phone -Member status -Member tags -Number of purchases -Number of redemptions -First purchase date -Last purchase date -Birthdate -Enrollment date -Last modified date -Anniversary date -Preferred language -Loyalty tier name -Loyalty tier Id -Qualified points -Tier current period start -Tier current period end -Lifetime points earned -Lifetime points expired -Lifetime points redeemed -Lifetime points deducted -Available points -Referral URL -Custom attributes -Zinrelo member ID |
Event fields you can create in Salesforce
Events | Fields |
---|---|
Points awarded | -Award Transaction Id -Award transaction approved date -Award transaction created date -Activity ID -Activity name -Award points status -Points awarded -Points expiration date -Auto approval date -Member tags -Number of purchases -First purchase date -Last purchase date -Last modified date -Loyalty tier name -Qualified points -Lifetime points earned -Available points -Custom attributes |
Points redeemed | -Redeem transaction Id -Redeem transaction approved date -Redeem transaction created date -Redeemed points status -Points redeemed -Reward ID -Reward name -Reward link -Coupon code -Member tags -Number of redemptions -Last modified date -Lifetime points redeemed -Available points |
Points deducted | -Deduct transaction Id -Deduct transaction created date -Deduct transaction approved date -Deduct points status -Points deducted -Loyalty tier name -Qualified points -Lifetime points earned -Lifetime points deducted -Available points |
Points expired | -Expired transaction Id -Points expired -Lifetime points expired -Available points |
Tier upgrade | -Loyalty tier name -Loyalty tier Id -Qualified points -Tier current period start -Tier current period end |
Tier downgrade | -Loyalty tier name -Loyalty tier Id -Qualified points -Tier current period start -Tier current period end |
Referral link shared | -Referral link shared channel -Referral link shared friend list |
Friend incentive request | -Friend incentive email address -Friend incentive coupon |
Referral success | -Referral success friend first name -Referral success friend last name -Referral success friend email -Referral success coupon code -Loyalty tier name -Loyalty tier Id -Qualified points -Lifetime points earned -Available points |
Campaign entered | -Campaign entered event name -Campaign entered event Id -Campaign entered delay in days -Entered campaign name -Entered campaign Id -Member tags -Loyalty tier name -Loyalty tier Id -Qualified points -Lifetime points earned -Lifetime points redeemed -Lifetime points deducted -Available points |
Campaign exited | -Campaign exited event name -Campaign exited event Id -Exited campaign name -Exited campaign Id -Member tags -Loyalty tier name -Loyalty tier Id -Qualified points -Lifetime points earned -Lifetime points redeemed -Lifetime points deducted -Available points |
Testing
To test if Salesforce Sales Cloud is successfully installed, follow the given steps:
- Add a member in Zinrelo Admin console.

- Once member is created, go to Salesforce Sales Cloud and click on the nine dots.

- Search for "Members" and click.

- Click on the drop-down and click "All."

- The member you added in Zinrelo Admin console will be visible in this page.
Note: If you do not see Members in nine dots drop-down, you have to create the member object.
Step 1: In Quick Search, search "Tabs" and click on it.

Step 2: Click on the "New" button.
Step 3: Enter the details.
- Select "Members" from the object dropdown.
- Select the tab style.
- Click on the "Next" button.

Step 4: Click on the "Next" button.

Step 5: Then, click on the "Save" button.
Updated about 12 hours ago