PhoneTools: Trigger creation

What’s supplied out the box?

PhoneTools comes packaged with triggers for the following objects:

  • Account
  • Contact
  • Lead

This means that if you’re only screening fields on the above objects, there is no requirement to add a custom trigger to your organization and you’re ready to move on to the next step.

If you plan to use PhoneTools on another object, continue reading.

Creating a trigger

We’ve made it as straightforward as possible to add a custom trigger to any object in Salesforce allowing you to start screening any phone field against the TPS and CTPS databases.

  • Go to Setup.
  • Navigate to Object Manager.
  • Locate the Object you want to create the trigger for.
  • Select Triggers and New.
  • Paste the following code snippet into the box provided.
Trigger PhoneToolsPhoneNumberUpdate_OBJECTLABEL on OBJECTAPI (before update) {
    pw_pss.PhoneNumberUpdateHelper.ProcessUpdate('OBJECTAPI', Trigger.oldMap, Trigger.newMap);
  • Replace OBJECTLABEL with the label name of the object you’re creating the trigger for.
  • Replace OBJECTAPI with the API name of the object you’re creating the trigger for.
  • Select Save.

Note: to deploy a custom trigger to production, you may be required to provide code coverage to the trigger. To do this, you will need to create an apex test to insert a record to the object you created a trigger on.

Back to the PhoneTools installation walkthrough

Leave a Reply