Managing components
The InCountry Data Residency for Salesforce package provides the following components:
Web-to-Lead component
note
This component is supported in the legacy package and in the three-model package for the restriction and redaction models.
note
This component is available upon request.
The InCountry Data Residency for Salesforce package provides a Web-to-Lead component that captures data submitted by website visitors, including their contact information, and then stores it as a Lead record in Salesforce.
Adjusting the Web-to-Lead component
From Setup, click Sites, and then click New.
On the Site Edit page, enter Site Label, Site Name, Active Site Home Page and check the Active box. A new empty Visual Force page can be chosen as
Active Site Home Page
(you can create this page by navigating to the Developer Console and following this path File > New > Visualforce Page).Click Save.
Click Public Access settings.
Click Enable Apex Class Access at the top of the page.
Click Edit.
Select the
InCountryWebToLeadService
class and click Save.Return to the Sites list and copy the site URL.
Go to the InCountry application and select the Web-to-Lead tab.
Paste the Border URL address (for example,
https://sa-proxy-mt-01.api.incountry.io/
) and appendx-inc-sa-mt-query/services/apexrest/leadservice
to this address for the fields with values that will be passed as query parameters within the request body orx-inc-sa-mt-body/services/apexrest/leadservice
for the fields with values that will be passed as JSON Body without query parameters. For more information, see the Creating new services section.Click the Save icon.
Select the fields you want to include in the form.
Enter the Return URL if required. If not needed, leave it empty.
Set the default user for the Lead, if needed.
Move the Use parametrized requests toggle right to enable such option. By default, it is enabled.
- If the toggle is activated, fields with values will be passed as query parameters within the request body. For example:
- If the toggle is disabled, fields with values will be passed as JSON Body without query parameters. For example:
As a result of the response, filed values will be returned to your Salesforce org as request parameters or within the request body, depending on the request type.
Click + Add reCAPTCHA and populate Public and Private keys if captcha is required. If not needed, leave them empty.
You can find out how to generate those keys here: Developer's Guide
Click Generate form > Copy to clipboard.
Paste this code on the required HTML page.
Parameterized requests
The Web-to-Lead component supports the functionality to handle parameterized requests. Below you can see an example of such a request:
POST https://sa-proxy-mt-01.api.incountry.io
/services/apexrest/leadservice?GRD_Sub_Type__c=Component%2FSystem+Mfr.
&Company=Test+Company
&GRD_Interested_In_Glass_For__c=Residential+Windows
&GRD_With_Benefits_Such_As__c=Solar+Protection
&FirstName=Sudesh
&LastName=Kumar
&Email=sudeshb1607%40gmail.com
&MobilePhone=%2B49+69+978997668
&GRD_Language__c=de
&Country=CF
&City=Munich
&PostalCode=80992
&GRD_Your_Message__c=Test+Message+for+Russia+Site
&GRD_Do_Not_Solicit__c=1
&Street=Test+Address+1+Test+Address+2
&Status=Unqualified
&GRD_Business_Reason__c=Web-To-Lead
&GRD_Priority__c=Medium
&GRD_Lead_Sub_Source__c=Information+Request
&recordType=0123h000000R6rq
&LeadSource=GRD_Website
&oid=00D0n0000009H3m
&encoding=UTF-8
Activity component
note
This component is supported in the three-model package for the redaction and restriction models.
The InCountry Data Residency for Salesforce package provides the Activity component as a replacement for the native Activity component.
Adding the Activity component to the page layout
note
Please follow these instructions if you use Salesforce Lightning.
Open the list for a specific object and select a specific record.
Click Setup, then select Edit Page.
On the Lightning App Builder page, add a new tab. Select
Custom
and enter a custom label.Drag the
activityPanel
component to the tab.Regulate the visibility of components by adding filters.
Click Save.
Click Activation and activate the modified page.
Working with the Activity component
The Activity component allows you to manage tasks, log calls, and schedule events with your customers and prospects. InCountry’s equivalent of this component resembles the native Salesforce component and provides a similar user experience.
Creating a new task activity
Within the Activity component, locate the New Task tab and select it.
Click Add new Activity.
Fill out details of a new activity.
Click Save.
Filtering task activities
Select the New Task tab.
Locate the Filter icon and click it.
Define the filtration criteria.
Click Apply or Apply & Save (to permanently save the filtration criteria).
Logging calls
Select the Log a Call tab.
Enter the log summary.
Click Save.
Managing events
Select the New Event tab.
Fill in details for the event.
Define the event time.
Click Save.
Closing tasks
Locate the Task Timeline block.
Locate the task you want to close and hover over it.
Check the box. The task is closed.
If you closed the task accidentally, clear the box.
In the Choose Status form, select the current status of the task.
Click Save.
Managing the Email Message component in the Legacy Replicated model
The InCountry Data Residency for Salesforce package provides the Email component supporting the data compliance when sending emails from Salesforce.
Configuring the Email Message component
To configure the Email message component for the replicated model, you need to perform the following steps:
Creating a data regulation policy
On the menu, select Settings.
In the Select Object box, select the Email Message object and click Add Policy. The Add Policy form opens.
In the Type box, select
record
. The data regulation policy will be applied to Salesforce objects of the record type. This means, that each email message (as a record) will be saved to the country of origin based on the country attribution.In the Behavior box, select Replication.
In the Destination Country box, select the country for storing and processing the regulated data according to the select data regulation model. The following steps will customize the Related To field shown below:
Move the Controlled By Parent toggle right to enable the inheritance of configuration from the parent object.
In the Select Parent box, enter
Related To ID (Account)
.note
Please note that the User, Lead, and Contact objects are not supported by the Related To field. When you create a regulation policy for these objects, start entering and choose from the drop-down list Related To ID (Account) or any other Salesforce object that has the same field that the required object (User, Lead, or Contact) includes.
In the Source Field box, enter the name of the field which stores the country value. For example: Country field.
In the Source Field Value box, enter the name of the country as you specify it while creating records related to the Email Message object. The value stored within the field will be saved to the country you select in the Destination Country box. This configuration option is available at the record level only.
Save the data regulation policy.
Adding the InCountry Apex trigger
The InCountry Apex trigger allows you to set automated deletion of email messages from the InCountry platform, when they are deleted from Salesforce. To add the InCountry Apex trigger, follow the steps below:
Open the Developer Console.
From the File menu, select New, then click Apex Trigger.
Populate the trigger name and select the respective sObject. The name must be InCountryEmailMessage.
Click Submit.
Replace the trigger body with the code below.
trigger InCountryEmailMessage on EmailMessage (before delete, after delete) {
SObjectType triggerType = Trigger.isDelete ? Trigger.old.getSObjectType() : Trigger.new.getSObjectType();
if (Trigger.isDelete && !InCountryReplicationTriggerHandler.disableTrigger && !InCountryReplicationTriggerHandler.alreadyExecuted(triggerType)) {
InCountryReplicationTriggerHandler handler = new InCountryReplicationTriggerHandler(triggerType.getDescribe().getName());
if (Trigger.isBefore) {
handler.handleBeforeDeleteEmailMessage();
} else {
handler.handleAfterDeleteEmailMessage();
InCountryReplicationTriggerHandler.registerExecution(triggerType);
}
}
}
Creating a Visualforce page with the Email Message component
note
Please follow these instructions if you use Salesforce Classic.
Navigate to Setup.
On the sidebar, select Custom Code, then select Visualforce Pages.
Click New.
On the Visualforce Page page, specify the following information:
Label - enter the page label.
Name - enter the page name.
Description - enter the description of the page.
Visualforce Markup - add the following Apex code of the Email Message component:
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" docType="html-5.0" standardController="Account" applyBodyTag="False" applyHtmlTag="False"> <head> <apex:slds /> <apex:includeLightning /> </head> <body class="slds-scope"> <div id="lightning" /> <script> $Lightning.use("c:inCountryEmailApp", function() { $Lightning.createComponent("c:inCountryEmail", { recordId: "{!Account.Id}", objectApiName: "Account" }, "lightning", function(cmp) {} ); }); </script> </body> </apex:page>
Click Save.
note
The code snippet above is valid for the Account object. To make it valid for any other Salesforce object, enter the appropriate Salesforce object name in the following parts:
standardController="Account"
recordId: "{!Account.Id}"
objectApiName: "Account"
Once you have saved the page, you need to add it to the Flexipage layout. Navigate to Setup.
On the sidebar, select Objects and Fields, then select Object Manager.
On the Object Manager page, locate the Salesforce object which you want to add the Email Message page for and select this object.
On the sidebar, select Page Layouts.
Add a new section.
Select Visuaforce Pages.
Locate the newly added Visualforce page with the Email Message component.
Drag the Visualforce Page to the new section.
Click the Properties icon.
In the Visualforce Page Properties form, enter the height in pixels (by default, use 550 px) and check the box to show the scrollbar.
Click OK.
Adding the Email Message component to the page layout
note
Please follow these instructions if you use Salesforce Lightning.
Open the list for a specific object and select a specific record.
Click Setup, then select Edit Page.
On the Lightning App Builder page, add a new tab. Select
Custom
and enter a custom label.Click Done.
Select the newly added tab on the page layout.
Drag the
InCountryEmail
component to the tab.Click Save.
Click Activation and activate the modified page.
Managing the Email Message component in the Redacted/Restricted model
When you use the redaction or restriction data regulation policies, redacted data is stored in Salesforce. This can cause problems when communicating with contacts or leads by email. The package provides the Email Message component that allows you to send emails with redacted values that will be unredacted by Email Gateway.
Prerequisites
Configure the Email Gateway which can accept requests from Salesforce.
- Create an Email Gateway on the InCountry Portal. As the result, you will get credentials to integrate with Email Gateway.
Configuring the Email message component
warning
Before configuring the Email Message component, please register an email gateway within the same environment and country which your Salesforce service is attributed to.
To enable the email processing by Email Gateway, you need to perform the following steps:
Creating an email relay
You need to set up an email relay for Salesforce-generated emails by configuring Salesforce to automatically route emails through your company’s SMTP server. If your company sends emails from more than one email domain, you can configure an email relay for each domain.
From Setup, select Email, then select Email Delivery Settings, finally, click Email Relays.
On the list with email relays, click Create Email Relay.
Configure the email relay as follows:
Host - enter the address of the Border host you received when creating a Border configuration (for example, (
se-proxy-mt-01.staging.incountry.io
)).Port - specify the SMTP port as
587
.TLS Setting - select the
Required Verify
option.Enable SMTP Auth - check the box to enable SMTP authentication.
Auth Type - select the
Auth Plain
option.Username - enter the Client ID that you received on the InCountry Portal after registering an email gateway.
Password - enter the Client Secret that you received on the InCountry Portal after registering an email gateway.
Confirm Password - re-enter the Client Secret.
Click Save.
Creating organization-wide SMTP addresses
When sending emails from Salesforce, you can select your own email address or the organization-wide email address from which the email will be sent (the From field).
From Setup, select Email, then click Organization-Wide Addresses.
Click Add.
Fill out the following fields:
Display Name - specify the name explaining who an email is sent from.
Email Address - specify the email address which the letter will be sent from.
Choose the user profile for this email address.
Click Save.
Upon completion of this step, a verification email will be delivered to your mailbox.
Creating an email domain filter
An email domain filter determines whether an email relay is restricted to specific domains. You can create multiple domain filters and set their priority order. An email domain filter must be set up for email relay to work.
From Setup, select Email, then select Email Delivery Settings, finally, click Email Domain Filters.
Click Create Email Domain Filter.
Enter the following information:
Sender Domain - leave it empty (leave the * (asterisk) sign as-is).
Recipient Domain - leave it empty (leave the * (asterisk) sign as-is).
Email Relay - select the email relay that you have created.
Active - check the box to activate the email domain filter.
Click Save.
Configuring email deliverability
When you send emails from Salesforce, you would like to deliver emails to your recipients as coming from your domain instead of https://salesforce.com
. The latter can cause problems in email deliverability and increase the chances of your emails being marked as spam. This is why you need to disable the Email Security Compliance feature.
From Setup, select Email, then click Deliverability.
Clear the Activate bounce management box.
Clear the Enable compliance with standard email security mechanisms box.
Click Save.
Lead Convert component
note
This component is supported in the legacy package and in the three-model package for the restriction and redaction models.
The InCountry Data Residency for Salesforce package provides the Lead Convert component that converts a lead to an account, contact, or opportunity using information from the lead you’re converting.
For the details on this functionality, please check our documentation.
Converting leads
In order for the leads to be converted according to the record level policy, it is mandatory to map the fields in Setup (country, address, city, state and so on) with the Lead, Account, Contact and Opportunity fields.
From Setup, select Custom Metadata Types.
Click Manage Records next to InCountry Lead Convert Mapping.
To add a compound field (e.g. country field), click New.
Add other compound fields as shown above.
note
Compound fields are comprised of several fields (so-called constituents), for example the Address field includes the City, Zip code, State, and other fields. When converting, all these fields should be matched between the source Salesforce object and the target Salesforce object. You need to add the logic for each constituent of the compound Address field for all Salesforce objects which a lead can be converted to.
To do this, it is necessary to add a new item to the Lead Convert Mapping. For EACH constituent of the compound Address field, you need to create a new item.
When creating, you need to specify the API name of the field on the lead object. To get API names of fields, navigate to Object Manager, open the related Salesforce objects and on the Fields and Relationships tabs you can find the API names for required fields. These fields will take values from the lead record passing through conversion.
From Setup, select Object Manager.
Select Lead.
Select Fields & Relationships.
In the top right part of the screen, click Map Lead Fields.
Use the tabs (Account, Contact or Opportunity) to map each of your organization's custom lead fields to one of your custom account, contact, or opportunity fields.
Click Save.