SaaSquatch Help Center

Details about the Invocable Methods and Apex Triggers available in the SaaSquatch for Salesforce Integration.

Getting Started: Installation

Installation instructions for the SaaSquatch Integration can be found in our Salesforce Installation Guide. It is recommended to follow that guide to complete the initial installation before adding any of the customizations outlined in this guide.

🔗 Process Builder vs. Workflow Rules vs. Apex Triggers

Salesforce provides a number of tools for automating your business processes, including Lightning Process Builder, Workflow Rules, and Triggers.

The Salesforce Process Builder tool provides teams the ability to build and configure simple worksflows using drag-and-drop and point-and-click tools without the need to write any code.

Workflow Rules can help automate processes like Tasks, Email Alerts, Field Updates, and Outbound Messages. Each Workflow Rule consists of a Criteria and either an Immediate action or a Time-dependent action.

Apex Triggers are built using Apex code and are an advanced functionality available in Salesforce which provides the ability to build out custom functionality and workflows.

In most cases it is recommended to build something in Process Builder unless the desired functionality cannot be acomplished there. Business processes configured in Process Builder are much more stable in the long term compared to Workflow Rules and Apex Triggers as they don't require continual updates to remain functional.

Further details about which tool to use when automating your business processes through Salesforce can be found in the Salesforce Trailhead.

🔗 Example Conversion Trigger via SFDC Process

The next part of this page will detail an example process that will convert a referral in a Growth Automation program via use of Custom Fields.

Note: Conversion by an event type trigger is not currently available with SaaSquatch Integration. Contact your support team for more details.

🔗 A. Add Custom Field to your Contact or Lead Object

🔗 1. Create a New Custom Field

From the Lightning "Fields & Relationships" menu in the Contact or Lead Object Manager page, select the option to create a New Custom Field.

After selecting the Field Type that suits your needs, make sure to fill out the Field Label, the Field Name, and a description of the process and complete the rest of the Custom Field Creation.

🔗 2. Include Custom Field in Contact/Lead Layout

Head to the Lightning "Page Layout" menu in the Object (Contact/Lead) you just added that new Custom Field to, and ensure that that field is added to a Page Layout that is in use so you can make use of that field.

Details about adding a Custom Field to your Salesforce Object can be found in the Salesforce Trailhead.

🔗 B. Add SaaSquatch Process Builder Action

🔗 1. Create a New Process

From the Lightning Process Builder page select the option to create a New Process. Make sure fill out the Process name, a description of the process, and when the process starts.

It is also possible to add one of the SaaSquatch Invocable Methods to an existing Process. This can be done by adding an action in Step 4 of this guide.

🔗 2. Choose an Object

Click + Add Object to select the subject of the Process start criteria. When this chosen object is either created or updated that will start the process.

🔗 3. Add Critera

The Critera being checked in order for your Process to continue running will depend on what you are looking to accomplish with your Process. For example, this Critera could be something like looking for a specific field in the contact record having been updated.

🔗 4. Add Action

The SaaSquatch Invocable Methods can be added as actions in Process Builder. Make sure you have created a Custom Object Field and displayed in the Page Layout of your Salesforce Object of choice (Lead or Contact) before proceeding with the next step.

  • A. Click + Add Action and select an Apex Action Type. Growth Automation programs will require an addition or change to a "Lead" or "Contact" Object.
    See screenshot:

  • B. Select and Define the Action:
    • Select a name for your Action, something like "Convert Referral" or how frequently the action should run, like "Always".
      See screenshot:

    • Select the Apex class you would like to use. In this example the "Upsert User by Contact" class was used. Details about each of the available Invocable Methods in the SaaSquatch Integration can be found below.
      See screenshot:

    • Set the Apex Variables: The SaaSquatch Invocable Method Upsert User by Lead will sync a customField to the SaaSquatch record when the associated custom Field in SFDC is created or changed.

      In this example the field1Key is equal to the SaasSquatch customField value and the field1Value is equal to the property of thecustomField`'s attached value pairing:

      Profile -

Details about adding an actions or criteria to your Salesforce Process can be found in the Salesforce Trailhead.

🔗 Invocable Method List

The Referral SaaSquatch integration provides the following Invocable Methods for use in your Salesforce instance.

Please Note: Invocable Methods tagged with Classic are only applicable to programs running on our Classic referral programs, not those on our Growth Automation platform. Please contact SaaSquatch to find out which method is right for your program.

Method Name Version Introduced Input Variable Name Expect Variable Type Expected Value Description
Track Event by Id v1.4.0 usersEvents String Id Track a list of events for SaaSquatch Users based on their SaaSquatch User and Account Ids
Track Event by Lead v1.4.0 usersEvents Lead Lead Track a list of events for SaaSquatch Users based on their associated SFDC Lead record
Track Event by by Contact v1.4.0 usersEvents Contact Contact Track a list of events for SaaSquatch Users based on their associated SFDC Contact record
Upsert User by Id v1.3.0 usersUpserts String Id Update a list of SaaSquatch Users based on their SaaSquatch User and Account Ids. As of v1.4.0 supports Immediate Object Upsertion.
Upsert User by Lead v1.3.0 usersUpserts Lead Lead Update a list of SaaSquatch Users based on their associated SFDC Lead record. As of v1.4.0 supports Immediate Object Upsertion.
Upsert User by Contact v1.3.0 usersUpserts Contact Contact Update a list of SaaSquatch Users based on their associated SFDC Contact record. As of v1.4.0 supports Immediate Object Upsertion.
Classic Upsert User by Opportunity v1.3.0 usersUpserts Opportunity Opportunity Update a list of SaaSquatch Users based on their associated SFDC Opportunity record. As of v1.4.0 supports Immediate Object Upsertion.
Classic Convert Referral by Id v1.2.0 idsToConvert String Id Converts a list of SaaSquatch Accounts based on their SaaSquatch Account Ids
Classic Convert Referral by Contact v1.2.0 contactsToConvert Contact Contact Converts a list of Salesforce Contacts
Classic Convert Referral by Opportunity v1.0.0 opps Opportunity Opportunity Converts a list of Salesforce Opportunities

🔗 Custom Triggers

Advanced users can also use an Apex Trigger to call SaaSquatch invocable methods. If you're looking for a more fine-grained alternative to Process Builder check out Using a Salesforce APEX Trigger to upsert a Lead

🔗 Default SaaSquatch Triggers

The SaaSquatch Integration includes a number of built in triggers. The majority of these triggers are enabled by default to provide the standard functionality of the integration, such as linking Users to Contacts & Leads and cascading custom fields.

A full list of the available SaaSquatch Triggers can be found in your Salesforce instance under Setup -> Custom Metadata Types -> "Manage Records" for "Referral SaaSquatch Trigger". You can disable these triggers individually to help diagnose compatibility issues with any other triggers and processes in your Salesforce organization.

🔗 Classic only Optional Triggers

🔗 Configuring Additional Fields to be Synced to Leads/Contacts

As of version 1.7.0 of the SaaSquatch Integration, you can now configure user fields to be synced to custom fields on your Lead and/or Contact objects in Salesforce. You can edit your synced fields in Step 2 of your Salesforce Integration setup on the Integrations page of your SaaSquatch tenant.

🔗 Convenience Mappings

Label Description Recommend Salesforce Field type
User - Program Referral Code Evaluates to the primary referral code for the selected program. Text
User - Program Share Link Evaluates to the primary share link for the selected program. Text or URL
User - Segments Evaluates to a true/false value representing whether the user is in the inputted segment Checkbox
User - Custom Field Evaluates to the value of the inputted custom field. Text
User - Statistic A calculated user statistic. Note, user statistics are not updated in real time and can be up to 24 hours out of date. -
- Date Modified DateTime
- Traffic Number
- Referrals Number
- Conversions Number
- Goals Number
- Rewards Number
- Widget Loads Number
- Revenue Currency
- Generated Revenue Currency
- Referred Revenue Currency

🔗 Advanced JSONata input

By selecting Advanced - JSONata expression you will be able to use JSONata expressions to combine static values, logic, and values from the user context.

To read more about JSONata, read the documentation here.

Example User Context JSON:

  "id": "0000001",
  "accountId": "0000001",
  "firstName": "Maggie",
  "lastName": "Grey",
  "email": "",
  "imageUrl": "",
  "firstSeenIP": "",
  "lastSeenIP": "",
  "dateCreated": 1646159727900,
  "emailHash": "afdd2e3665f5db029df9a40bd06a5631",
  "referralSource": "UNKNOWN",
  "locale": "en_CA",
  "countryCode": "CA",
  "referralCodes": {
    "classic": "MAGGIEGREY",
    "r1": "MAGGIEGREY250",
    "r2": "MAGGIEGREY235"
  "programShareLinks": {
    "classic": "",
    "r1": "",
    "r2": ""
  "customFields": {
    "foo": "bar"
  "segments": [
  "stats": {,
    "dateModified": 1646159727900,
    "traffic": 5,
    "referrals": 5,
    "conversions": 5,
    "goals": 5,
    "rewards": 5,
    "widgetLoads": 13,
    "revenue": 133.33,
    "generatedRevenue": 133.33,
    "referredRevenue": 133.33

Example JSONate expressions:

  • "a static value"
  • user.firstName & ' ' & user.lastName
  • "vip" in user.segments ? user.referralCodes.`vip-rewards` : user.referralCodes.rewards

🔗 Supported Field types

Currently SaaSquatch supports syncing to Salesforce Custom fields with the following field types:

Salesforce Field Type Example Values
Checkbox true, false, "true", "false", 0, 1
Currency 1.23, "1.23"
Date 1646071200000, "2022-02-28T18:00:00.000Z", "2022-02-28"
DateTime 1646071200000, "2022-02-28T18:00:00.000Z", "2022-02-28"
Email ""
Number 42, "3.34"
Percent 42, "3.34"
Phone "555-555-5555", "+15555555555"
Text "Example text"
Text Area "Example text"
Text Area (Long) "Example text"
Text Area (Rich) "Example text"
Text (Encrypted) "Example text"
URL ""
Lookup Relationship "0015f00000BDEqbAAH"