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.

🔗 Workflow Rules vs. Apex Triggers

Salesforce provides a number of tools for automating your business processes Workflow Rules and Triggers.

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.

You may select either tool based on your business needs and development bandwidth.

Further details about which tool to use when automating your business processes through Salesforce 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.

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.

🔗 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 Workflow rules 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.

🔗 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": "mgrey@example.com",
  "imageUrl": "https://www.example.com/cat.jpg",
  "firstSeenIP": "1.1.1.1",
  "lastSeenIP": "1.1.1.1",
  "dateCreated": 1646159727900,
  "emailHash": "afdd2e3665f5db029df9a40bd06a5631",
  "referralSource": "UNKNOWN",
  "locale": "en_CA",
  "countryCode": "CA",
  "referralCodes": {
    "r1": "MAGGIEGREY250",
    "r2": "MAGGIEGREY235"
  },
  "programShareLinks": {
    "r1": "https://www.example.com/mz22n",
    "r2": "https://www.example.com/mz92k"
  },
  "customFields": {
    "foo": "bar"
  },
  "segments": [
    "vip",
    "closed"
  ],
  "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 "example@example.com"
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 "app.referralsaasquatch.com"
Lookup Relationship "0015f00000BDEqbAAH"