Automation Events

The Send2CRM package can be configured to conditionally raise Salesforce Platform Events for inbound data. This expands the options for custom processing including providing access to data not automatically saved to Salesforce, such as custom Session Events.

Configure Automation

An automation record is required to trigger custom events.

  • Set the Action Type to “Raise a Platform Event”

  • Set a short Name Value that can be used for identification

  • The Tested Data Type is both used for checking conditions and is provided to the Platform Event

For best performance, place as many conditions as possible in the automation instead of in the Flow or trigger that handles the event. This stops the Platform Event from being raised when not required.

Handle Platform Event

Create a Salesforce Flow or trigger to handle the Send2CRM Automation Event (send2crm__s2cAutomationEvent__e). This includes the following fields:

Automation (send2crm__s2cAutomation__c)

The Id of the Automation record that triggered the event.

Event Name (send2crm__Event_Name__c)

The Name Value from the automation record.

Event Data (send2crm__Event_Data__c)

Serialized JSON containing values from the Tested Data Type object.

Visitor Id (send2crm__VisitorId__c)

The Id of the associated Visitor record. Note this may be null for form submissions that do not implement identification.

Match Automation

The first step is generally to ensure that you are handling the correct automation. In a Salesforce Flow, this can be achieved in one of two ways:

  • Match the Id of the automation record, or

  • Match the Event Name against the Name Value of the automation. This option allows multiple automations to raise the same event without having to edit the handler.

Load Visitor

To update relevant Salesforce records, load the Send2CRM Visitor record to access lookup values for related records such as Lead. Match the Visitor Id field from the Platform Event record.

Get Send2CRM Data

To extract individual values from the Event Data field, use the Send2CRM "Get field from event data" Apex action. This requires:

  • Field accessor: property identifier for the field within the raw data. The accessor uses the same structure as form field mappings and conditions.

  • Serialized data: the Event Data field value.

This step allows extracting data that would not otherwise be saved to Salesforce.

The outputs from this action provide four possible options, each for a different type of value:

Values are null if the field is not of a matching type, you may need to test for this before use.

Perform Updates

The choices are endless! You could:

  • Set a value on the Lead record associated with a Visitor

  • Generate a notification

  • Send an email

  • Save custom data