Salesforce:APEX Triggers

From Melissa Data Wiki
Revision as of 18:17, 18 January 2022 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

← Clean Suite for CRM:Salesforce

Salesforce Navigation
Introduction
Getting Started
Installation
Getting Started with Lightning Components
Credits
Lightning Components
Lightning Quick Actions
Lightning Lookups
Lightning Global Express Entry
Clean Suite Advanced Mappings
Clean Suite Batch Processing
Result Code Status Indicator
Visualforce Pages
Installing Visualforce Pages
Custom Visualforce Pages
Custom Code
APEX Triggers
Custom Clean Suite Batch Processing
Express Entry Lightning Action Override
Result Codes
Salesforce Result Codes



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