Loqate integration Salesforce CRM

Download plugin here

Installation Steps 

In order to complete the set-up for the Loqate search functionality in salesforce you have to install the app via one of the following links: 

Live: [URL to be provided] 

Sandbox/test: [URL to be provided] 

You will be taken to the following page:  

Install the application just for Administrators, and then other profiles can be allowed access to the finder pages without giving access to the Management page. Once that installation is complete simply hit done.

Back in your salesforce organisation if you are using the lightning interface click on the app launcher in the top left hand of the screen and select ‘Loqate Address Verification App’ > ‘Management’

 

If you already have a Loqate account you can Skip the registration step and simply enter your existing key.

If you don’t have an account with Loqate you can register for an account here.

This will give you a key and credit to trial the app. Without a Loqate account you will not be able to perform any lookups. When you first install the app you will be presented with a free trial sign up window. Enter your details and click Register. This will generate the required key for you and send you an email with your account details.

Common Setups

Remote Site Settings

Add Loqate API as the remote site settings.

You can access this from Setup>Home>Remote Site Settings (Type: Remote in Quick Find box)

CSP Trusted Sites

Add Loqate as a CSP Trusted Site

You can access this from Setup>Home> CSP Trusted Sites ( Type: CSP in Quick Find box)

Custom Fields

If you have a custom address field you will need to tell the app which address information to populate it with. This is done by adding a new field mapping on the app Management page.

  • Go to PCA Predict – Management
  • Select the address you wish to add a new field to

Select New Field

  • Enter the name of the field
  • Select the type of address information to populate the field with
  • Save the record

Custom Objects

You can map a new set of address fields, or an address for a custom object, by creating a new set of address fields.

  • Go to PCA Predict – Management
  • Create a New Address Form

  • Select the object that this address relates to from the list

  • Give the address a unique name to identify it
  • Save the address
  • Follow the steps above to map the fields for this address

Custom Settings

Update the endpoints in the Custom Settings

You can get here from Setup > Home >Custom Settings (Type Settings in Quick Find box). Click on Manage link near Postcode Anywhere Settings

 

 

Load Country Table

Import Country data

Navigate to the Loqate verification app for Salesforce CRM

 

Follow the wizard and load the country table from a CSV file.

 

Loqate for Salesforce Lightning Experience

Lightning App Builder Components

With this new upgrade you can leverage three Lightning Web Components powered by Loqate to enable verification of address, email, and phone. The address verification component can be configured to provide a ‘no-type’ user experience analogous to a date picker to be able to pick an address from a list filtered based on the user’s geolocation coordinates.

These lightning components can be accessed from Lightning App Builder and is easy to configure. You can also leverage the component visibility features to rollout localized versions of the same component for your users across geographies, reducing the need to configure separate record pages for your global users.

Here we show you how to add the components from Salesforce Lightning App Builder

You can see the new LWC Components under the Custom Components in the left had side

To add a component, drag the component onto the Canvas

Component Title: Title to be displayed on the page ‘Verify Billing Address’, ‘Verify Mailing Address’ or simply ‘Verify Your Address here’

Address Type: Billing, Shipping, Mailing

Language: The preferred language for result 2 or 4 language code e.g en, fr, en-gb, en-us

Countries: ISO Char 2 or 3 code of countries to which you which to limit your Search

Response to Address Mapping: The mapping of the Address you created here. Eg AccountBilling

These components are Salesforce Object aware components and can be used on any Salesforce object where the address fields can be mapped in the Loqate setup.

You can also leverage the OOTB Component capabilities like ‘Set Component Visibility’ to control visibility on who accesses the component– even user and role-based filter criteria. More information on that here.

Here’s the list of other components that you can use and sample setup for your guidance:

Loqate Address Capture component

Loqate Email validation component

Loqate Phone Number validation component

Loqate for Salesforce Classic (Legacy experience)

For customers still using the Classic UI

There are two basic ways to implement the Loqate application in Salesforce Classic. ‘On Request Validation’ and ‘Auto-Validate in Real time’ Each of these detailed in the management section and each has it’s own set-up method.

Validate on Request:

To start this method simply click the 'Set up ‘on request’ Validation’ button. This will generate a series of default mapping sets that relate to standard salesforce objects. You then have to a custom button to each page as follows:

  • Go to Setup – Customize – Leads – Page Layouts - Edit the relevant layout
  • Drag and drop the Address Finder button from the Buttons tab onto the layout
  • Save the changes, and repeat for Accounts and Contacts

Once you have completed these steps, go to a Lead, Account or Contact detail page, click the Address Finder button, and test that address changes are working.

Security Settings

You may find that some of your user profiles are unable to view the Address Finder pages. If this is the case you will need to go to Setup – Develop – Pages – Security for each of the Address Finder pages and move all required profiles from Available Profiles to Enabled Profiles.

When you create a new address form you will need to create a Visual Force page to display the address finder component. You can clone one of the existing pages in order to do this.

  • Go to Setup – Develop – Pages
  • Locate one of the existing finder pages, such as Account Address Finder, and copy the Visual force mark-up from that page.
  • Return to Setup – Develop – Pages and click ‘new’
  • Give the new page a name, label and paste the visual force mark-up into the new page
  • Modify the Visual Force code so that it references the correct object and field
    • You may need to change c:AddressFinder to pca:AddressFinder
  • Save the new pageCreate a new button for you object to show the new page
  • Add the button to the object page layout as detailed above

This process requires developer permissions, and may need to be done in your sandbox org before being deployed to your live environment.

Auto-Validate in Real Time:

To start this method click the ‘Set Up Auto Validation’ This will expand the set-up window:

In the set-up window you must complete the following:

  1. Select the services you wish to make use of using the tick boxes
  2. For each page select the layout you wish the cloned page to be based on and click ‘Clone’ After a short delay the page layout will have been successfully cloned by our application.
  3. Once this process has been completed click ‘Live’ to replace your standard salesforce page with our newly created visual force ‘Clone’ page.
  4. If at any point you wish to revert this simply select the ‘Reset’ button in the section of the Loqate management area.

There is also a third more advanced set-up method you can make use of in classic if you use custom visual force pages in your organisation.

In order to use this you have to do the following:

  • Open your Apex code for your Visual force page
  • Toward the top of your page add the following scrip and style include tags:

 

<apex:includeScript value="{!URLFOR($Resource.PostcodeAnywhere, 'sensor.js')}" />        <apex:stylesheet value="{!URLFOR($Resource.PostcodeAnywhere, 'platformcaptureplus-2.00.min.css')}" />        <apex:includeScript value="{!URLFOR($Resource.PostcodeAnywhere, 'platformcaptureplus-2.00.min.js')}" /> 

  • Locate the input fields for your address and add an appropriate ID attribute to the field as follows

 

<apex:inputField id="MailingAddress_pca_street" value="{!Contact.MailingStreet}" required="false" />

Add the following JavaScript to the end of your visual force page:

<script type="text/javascript"> 

    (function() { 

       

        try{ 

            sforce.connection.sessionId = '{!$Api.Session_ID}'; 

            var countries = []; 

            var query = "SELECT Name, pca__Index__c FROM pca__PostcodeAnywhereCountries__c";  

            var records = sforce.connection.query(query);  

            var countrieRecords = records.getArray('records');  

            for(var i=0;i<countrieRecords .length;i++){  

                countries.push(countrieRecords[i].Name); 

            } 

        } 

        catch(e){  

            countries = []; 

        } 

                

         

        var origin = "FR";                     

  

        //Options Address 

        var optionsAddress = { 

            key: "{!$Setup.pca__PostcodeAnywhereSettings__c.pca__Key__c}", 

            countries: { defaultCode: origin }, 

            search: { countries: countries.join(","), language: "ENG" } 

             

        }; 

  

           var fieldsMailingAddress = [ 

              { element: "MailingAddress_pca_street", field: "{Line1}" }, 

              { element: "MailingAddress_pca_city", field: "{City}", mode: pca.fieldMode.POPULATE }, 

              { element: "MailingAddress_pca_state", field: "{Province}", mode: pca.fieldMode.POPULATE }, 

              { element: "MailingAddress_pca_postcode", field: "{PostalCode}" }, 

              { element: "MailingAddress_pca_country", field: "{Country}", mode: pca.fieldMode.COUNTRY } 

           ]; 

           //control for MailingAddress (Addressservice) 

           var controlMailingAddress = new pca.Address(fieldsMailingAddress, optionsAddress); 

  

     })(); 

</script> 

Note that the ‘element’ attributes within the fields MailingAddress must map the IDs set in the previous step. Additional information on the address mapping method here can be found in our Advanced Set-up Guide.

The solution is now fully installed and ready to use within your Salesforce Orginisation. Remember, if you have any problems we're here to help.