Salesforce Lightning
Integration guide for leveraging your Salesforce Lightning customer data.

Objective

Deploy a Pre-Registration hook in Strivacity Fusion which can retrieve contact information from Salesforce Lightning ('Salesforce') and perform data comparisons before allowing customers to register.

Overview

In this example integration, we will be retrieving contacts from Salesforce. The Pre-Registration hook will check for a customer's primary email address (not email identifier) in Salesforce's database. The hook will only allow customer registration in Strivacity Fusion if their primary email matches a contact in Salesforce.

Prerequisites

General

  • Basic familiarity with nodejs, javascript, or similar languages

Salesforce side

  • Salesforce Lightning platform
  • New Salesforce Lightning application
    • Consumer Key and Consumer Secret of the application
Before creating a new application in Salesforce Lightning, go through the configuration steps in the next section.

Strivacity side

Add the logic you see fit to our sample hook!

Configuration steps

Create a Salesforce app for integration

1) Go to Setup in Salesforce.
2) Navigate to 'App Manager' inside 'Apps' under Platform Tools in the side-menu.
3) Click 'New Connected App' in the top right corner.
4) Fill in Basic Information:
  • Name your new connected app
  • Add an API name
  • Enter a contact email
5) Select "Enable OAuth Settings".
6) Under API (Enable OAuth Settings)
  • Add a Callback URL for meeting configuration requirements.
The callback URL can be a generic one, such ashttp://localhost:1717/redirect. The callback URL is not actually used when customers are authenticated but it's a required configuration by Salesforce.
  • In 'Available OAuth Scopes' select 'Manage user data via APIs'
  • AND click the 'Add' arrow to move it to selected scopes.
7) Save your configuration.
You will be redirected to your new connected application.
Don't navigate away from Manage Connected Apps just yet.
8) Capture the 'Consumer Key' and 'Consumer Secret'.
Consumer key and secret will not be available after you close this window.

Create a Pre-Registration hook in Strivacity Fusion

1) In the Admin Console, got to Lifecycle Event Hooks.
2) Click 'Create Lifecycle Event Hook'
3) Fill in the basic information:
  • Name your new hook
  • Add a description
  • Select 'Pre-Registration' for the hook type
4) Save to continue.

Add dependencies

5) Click the gears icon on the top left corner of the IDE panel.
6) Select Add Dependency.
7) Search for the 'nforce' package and add its latest version,
You can collapse the IDE menu.
8) Go to our repository to fetch the Pre-Registration hook we provide as a jumping-off point for Salesforce integration.
9) Replace the default Pre-Registration code block with the hook code from the repository.
10) Provide the Salesforce
  • username at SFDC_USER and
  • password at SFDC_PASSWORD
you will authenticate with.
8) Provide the
  • Consumer Key at SFDC_APP_CLIENT_ID
  • Consumer Secret at SFDC_APP_CLIENT_SECRET
you've captured previously from the Salesforce connected app.
9) Paste the Callback URL at SFDC_APP_REDIRECT_URI you've provided to the Salesforce connected app.
10) Save your hook.
Your hook's status will stay Non-Deployed until you add it to an application.

Create a Strivacity Fusion application

1) Go to Applications and click 'Create Application'.
2) Add a name, description, and define the mandatory properties of the application.
3) Ensure the primaryEmail attribute of the selected Identity Store is mandatory.
4) Scroll down to Lifecycle Event Hooks and assign your Pre-Registration hook to your Strivacity Fusion test application to integrate with Salesforce.
5) Save your changes.
Copy the test application's self-service URL.

Test your integration

1) Go to an incognito browser.
Make sure only one incognito window is open as multiple windows share session information.
2) Go to the self-service portal of the Strivacity Fusion application.
3) Try to register a customer who:
  • has their email address registered in your Salesforce contacts. According to our example hook, this customer will be allowed registration.
  • doesn't have their email address in your Salesforce contacts. According to our example hook, this customer will be denied registration.
Implement additional logic for customers denied registration.
Last modified 3mo ago