Other#

Custom Code#

APEX Triggers#

Some users may have the need for their Salesforce records to be validated & standardized as soon as they’re entered or saved into Salesforce. In that case, an Apex Trigger would be appropriate for that. Setting up an apex trigger for Clean Suite involves going into Salesforce Setup and creating a new trigger on the object you would like the trigger to run on. Below is an example of an apex trigger for invoking the Global Address component on the Contact object after a record has been inserted or updated:

trigger globalAddress on Contact (after insert, after update) {
    for (Contact contact : Trigger.new) {
        if (!Test.isRunningTest()) {
            if(!System.isFuture() && !System.isBatch()) {
            MDPERSONATOR.MD_GlobalAddressWSExt.doOneGlobalAddress((String)contact.Id);
            }
        }
    }
}

The highlighted portion in the code snippet below can be changed to use the other components:

MDPERSONATOR.MD_GlobalAddressWSExt.doOneGlobalAddress((String)contact.Id);

  • MD_GlobalEmailWSExt.doOneGlobalEmail

  • MD_GlobalPhoneWSExt.doOneGlobalPhone

  • MD_PersonatorWSExt.doOnePersonator

  • MD_PropertyV4WSExt.doOneLookupProperty

Custom Clean Suite Batch Processing#

Batch processing allows you to run multiple records at once against Melissa services. Administrators can select specific records for processing through a query as well. This flexibility allows Administrators the ability to schedule regular jobs for record processing as well.

Clean Suite Batch Jobs are tied to a specific object and specific [Clean Suite Advanced Mapping]. Meaning, you must specify the type of salesforce object (standard or custom) as well as the mapping you wish to use for that job. Note, the mapping specified must exist for the object or the job will fail.

Set Up#

  1. Select the class of Melissa Endpoints to use from the following list:

    • MD_PersonatorBatch (Personator Verification)

    • MD_GlobalBatch (Global Address Verification)

    • MD_GlobalEmailBatch (Global Email Verification)

    • MD_GlobalPhoneBatch (Global Phone Verification)

  2. Choose the object and mapping you want to use.

    In the screenshot below we created a Contact mapping named “Mailing Address Verification” for the Personator Verification Web service.

    ../../_images/Salesforce_CSBatch_01_ContactMapping.png
  3. Craft the query In the example below we specified the Object Type from above and that we want only 10 records.

    SELECT ID FROM CONTACT LIMIT 10
    
  4. Craft the statement

    Now we need to put it all together! The following statement will execute a batch job using our query from above as well as taking into account the mapping we created in the earlier screenshot.

    Id batchinstanceId = Database.executeBatch(
      new MDPERSONATOR.MD_PersonatorBatch(
          'SELECT ID FROM Contact LIMIT 10',
      true, true, true, 'Mailing Address Verification'), 100);
    

    You can execute the code through the dev console via the execute anonymous or through your own Apex Code.

    ../../_images/Salesforce_CSBatch_02_ExecuteCode.png

Results from a Batch job#

To see the progress of your batch job, go to the Apex Jobs section in Setup and the job and status will be listed there.

../../_images/Salesforce_CSBatch_03_SeeResults.png

Every record that is updated by a Clean Suite Batch Job will have a Result object upserted as part of the process as well. The result objects and their associated webservices are as follows:

  • MD_personatorResult__c (Personator Verification)

  • MD_globalAddressResult__c (Global Address Verification)

  • MD_globalEmailResult__c (Global Email Verification)

  • MD_globalPhoneResult__c (Global Phone Verification)

Express Entry Lightning Action Override#

This page will guide you in enabling Express Entry in your Salesforce Environment:

Sample Code: Download here

Create the base Lightning Component to hold our override code#

  1. Open the Dev Console by clicking the “gear” icon at the top right and clicking “Developer Console”.

  2. In the Dev Console, click “File -> New” and choose “Lightning Component”.

  3. Fill out the New Lightning Component form. The Name field should be descriptive for future reference. In our case we chose to name it MD_ExpressEntry_Override. The Description field is optional.

    ../../_images/SF-ExpressEntry_01_NewLightningBundle.png

Copy and Paste the Component code into the .cmp file#

  1. Open the “ExpressEntryNew.cmp” file and copy the contents to your clipboard.

  2. Open the Component file of your new lightning component and paste the content inside, overwriting the existing content. In our case this file is named MD_ExpressEntry_Override.cmp.

  3. Hit Ctrl+S to save the current file.

    ../../_images/SF-ExpressEntry_02_CopyPasteComponent.png

Copy and Paste the Controller code into the Controller .js file#

  1. Open the “ExpressEntryNewController.js” file and copy the contents to your clipboard.

  2. Open the Controller file of your new lightning component and paste the content inside, overwriting the existing content. In our case this file is named MD_ExpressEntry_OverrideController.js.

  3. Hit Ctrl+S to save the current file.

    ../../_images/SF-ExpressEntry_03_CopyPasteController.png

Copy and Paste the Helper code into the helper .js file#

  1. Open the “ExpressEntryNewHelper.js” file and copy the contents to your clipboard.

  2. Open the Helper file of your new lightning component and paste the content inside, overwriting the existing content. In our case this file is named MD_ExpressEntry_OverrideHelper.js.

  3. Hit Ctrl+S to save the current file.

    ../../_images/SF-ExpressEntry_04_CopyPasteHelper.png

Override the default “NEW” action with our newly created Lightning Component#

  1. At the top right, click Setup and then Select Object Manager on the Setup tab.

  2. Navigate to the Contact object and select Buttons Links, and Actions on the left navigation tab.

  3. Find the NEW action and click the drop down on the right and click Edit.

    ../../_images/SF-ExpressEntry_05_EditAction.png
  4. Select the Lightning Component radio button on the Lightning Experience Override section and chose our newly created component from the drop down list. Then click Save.

    ../../_images/SF-ExpressEntry_06_SaveOverride.png

Validate that our component works#

  1. Create a new contact record.

  2. Being populating the fields.

  3. Type in an address in the Mailing Street field and after the third keystroke, suggestions should appear.

  4. Select an address from one of the suggestions and verify it populates the rest of the fields.

  5. Click Create New and validate a new record has been created with your selected address.

    ../../_images/SF-ExpressEntry_07_CreateNewRecord.png

Tutorial Videos#

Legacy Salesforce (Salesforce Classic)#