Deploy a 'Before registration' hook in Strivacity which can retrieve contact information from Salesforce Lightning ('Salesforce') and perform data comparisons before allowing customers to register.
In this example integration, we will be retrieving contacts from Salesforce. The 'Before 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 if their primary email matches a contact in Salesforce.
- 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.
- Identity Store where the primaryEmail attribute is mandatory
- Strivacity application to apply and test the integration
- Salesforce 'Before-registration' event hook
- Salesforce Lightning plugin from our Lifecycle Event Hook plugin-library
Add the logic you see fit to our sample hook!
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 as
http://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.
Our plugin library contains an off-the-shelf Salesforce event hook template that jumpstarts your integration process and allows you to customize it to your needs.
- In the Admin Console, go to Lifecycle Event Hooks.
- Click ' Add plugin'. You will be redirected to the plugin library.
- Click on the Salesforce logo. You can find it in the CRM section.
- There will be a pre-select for the event hook, so you only need to click 'Add'.
- Wait for the Salesforce hook template to be added.
If the Admin Console doesn't want to add the hook, it's most likely that the name of the hook is already taken. Click 'Edit' and you can modify the name of the event hook. Then continue with 'Try again'.
- If the hook has been successfully added, you can return to the list view with 'Back to plugin library', then 'Back to event hooks'.
- Select the Salesforce event hook you've just added.
- In editor view, click on the cube icon on the top left corner of the IDE panel.
- Click 'Add dependency'.
- Search for and add the following packages:
This should appear in the dependencies list on the left.
Beta packages may not be stable. For best results use the latest stable package versions.
- Provide the Salesforce
- username at SFDC_USER and
- password at SFDC_PASSWORD
you will authenticate with.
- 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.
- Paste the Callback URL at SFDC_APP_REDIRECT_URI you've provided to the Salesforce connected app.
- Click 'Save'. You can return to the event hooks with the 'Back to event hooks' button.
Your hook's status will stay Non-Deployed until you add it to an application.
- Go to Applications and click 'Create Application'.
- Add a name, description, and define the mandatory properties of the application.
- Ensure the primaryEmail attribute of the selected Identity Store is mandatory.
- Scroll down to Lifecycle Event Hooks and assign your 'Before registration' hook to your Strivacity test application to integrate with Salesforce.
- Save your changes.
Copy the test application's self-service URL.
- Go to an incognito browser.
Make sure only one incognito window is open as multiple windows share session information.
- Go to the self-service portal of the Strivacity application.
- 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.
Updated 3 months ago