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.

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

  1. Use your admin credentials to log in to your Salesforce account, and then click "Install for All Users."
installation
  1. Tick the acknowledgement box and then press the "Install" button.
  2. Wait for the installation to complete. And then click on "Done."
salesforce sales cloud integration SFMC Zinrelo Integration

Register Salesforce Site Domain

Things to consider while setting up Salesforce sites:

  1. Your company's Salesforce Sites domain is used for all the sites that you create.
  2. 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.
  3. 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.

  1. Click on "Setup."
  2. In "Quick Search," find "Sites" and click.
sites
  1. Tick "Site Terms of Use" and click on "Register my Salesforce Site Domain."
register site
  1. Click on “New.”
salesforce integration
  1. Fill up the details for your site.

site configuration

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.

  1. Activate your site domain when you’re ready to make your site available to the public. Click on the "Activate" button.
activate the site

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

SFMC Zinrelo Integration

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.

webhook

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

custom url

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:

  1. Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label."
apex classes
  1. Click on "Public Access Settings."
public access settings
  1. Click on "Apex Class Access."
apex class access
  1. Click on "Edit" >> Select the classes >> click on Add >> Save

give apex class access

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

  1. Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label." >> Click on "Public Access Setting" >> Click on "Object Settings."
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]

SFMC Zinrelo Integration
  1. Select the "Member" object.
SFMC Zinrelo Integration
  1. Click on the members to edit the object.
  2. Click on the "edit" button.
SFMC Zinrelo Integration
  1. Enable Object Permission and check the boxes for the associated fields before saving.
object permission

Contact access

  1. Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label." >> Select "Public Access Setting" >> Click on "Object Settings."
object settings
  1. Select the "Contacts" object.
contacts
  1. Click on the contacts to edit the object.
  2. Click on the "edit" button.
  3. Enable Object Permission and check the boxes for the associated fields before saving.
object permission

ZinreloDebugLogs access

  1. Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label." >> Click on "Public Access Setting" >> Click on "Object Settings."
object settings
  1. Select the "ZinreloDebugLogs" object.
SFMC Zinrelo Integration
  1. Click on the contacts to edit the object.
  2. Click on the "edit" button.
  3. Enable Object Permission and check the boxes for the associated fields before saving.
zinrelodebug logs

Give System Permissions

  1. Go to "Setup" > in the Quick Find Box search "Site" >> Click on "Site Label." >> Click on "Public Access Setting" >> Click on "System Permissions."
  2. Click on the "Edit" button.
system permission
  1. 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

Ssalesforce sales cloud integration

Configure Zinrelo keys

Step 1: Click on the label "Zinrelo Keys."

zinrelo keys

Step 2: Click on the "Manage Zinrelo Keys" or "Manage Records" button.

manage zinrelo key

Step 3: Click on "New."

SFMC Zinrelo Integration

Note: Record name should be Zinrelo.

Step 4: Update the value as per the given table:

LabelZinrelo
Zinrelo Keys NameZinrelo
Create Debug for Success[ ]
Insert New Zinrelo Member and Contact
Unique Identifier for Zinrelo MemberInsert Contact field API Name [or FIELD NAME]
HMAC Secret KeyCopy 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.]
fields and relationships

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:
  1. Login now to Zinrelo portal.
  2. Go to Zinrelo Site >> Expand Notification Tab >> Go To Webhooks >> Click on Settings >>Secret Key shown in below figure.
zinrelo webhook
  1. Copy same Secret Key from site and paste in HMAC Secret Key field.
  2. Click on "Save."

Configure Zinrelo event type

Step 1: Click on the label "Zinrelo Event Types."

zinrelo events

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

manage zinrelo events

Step 3: Click on "New."

SFMC Zinrelo Integration

Step 4: Click on the "Edit" button and fill in the following values:

LabelZinrelo Events
Zinrelo Event Types NameZinrelo_Events
Event Referral Link Shareevent_referral_link_share
Friend Incentive Requestevent_friend_incentive_request
Member Enrollmentevent_member_enrol
Member Tier Downgradedevent_member_tierdowngrade
Member Tier Upgradedevent_member_tierupgrade
Member Updatedevent_member_update
Points Awardedevent_points_earned
Points Deductedevent_points_deducted
Points Expiredevent_points_expired
Points Redeemedevent_points_redeemed
Referral Successevent_referral_success
Campaign Enteredevent_campaign_entered
Campaign Exitedevent_campaign_exited
zinrelo events

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.

ZinreloDebugLogs

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:

  1. Click the gear icon and select "Setup."
Setup
  1. Click on "object manager" and select "Contact object."
Contact object
  1. Select "Fields & Relationships" and click on "New."
Fields & Relationships
  1. Select "Formula" as the data type and click "Next."
Formula
  1. Give the field's name and label, and select the formula return type. And click "Next."
creating formula fields
  1. Click on "Advanced Formula" and then "Insert Field."
Insert Field
  1. 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.
Insert Field Insert Field

Insert Field

  1. Click "Next," select "Visibility," and click "Next."
Visibility
  1. Select the page layout where the field should be included. And click "Save."

  1. 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 ObjectFields
Member Profile-Member ID
-First Name
-Last Name
-Email
-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

EventsFields
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:

  1. Add a member in Zinrelo Admin console.
  1. Once member is created, go to Salesforce Sales Cloud and click on the nine dots.
  1. Search for "Members" and click.
  1. Click on the drop-down and click "All."
  1. 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.