Guided Selling Apex Jobs and Batch Operations

The Guided Selling managed package runs on a series of batch operations to power the logic and time-based actions required for an individual sequence. A high-level overview of each sequence is provided in the section below.

Revenue.io Server Integration

The Guided Selling package integrates with the Revenue.io Server in two ways:

Related Documentation

  1. Platform Events
    • The Revenue.io Server uses the RDNACadence__Email_Action_Event__e platform event endpoint to push email notifications to the Sequence package.
  2. The Revenue.io API
    • A set of web services that the Sequence package uses to do things like send emails, get status notifications about emails, and gate access to Sequence components if a user hasn't been provisioned in the Revenue.io web application. This API is used only when the API Key and Secret are added to the custom settings within Salesforce.

Responsibilities

The responsibility of the Revenue.io API is to perform the following tasks:

  • Do runtime license checks for Guided Selling users
  • Send the native email via the users authenticated provider account
  • Deliver open, replied, sent and link-click notifications to a platform event endpoint

Participant Batch Processes

The Guided Selling Participant Batch Process is logic that executes within the managed package to (1) execute automatic actions associated with a sequence, (2) flag subsequent actions to be shown on the Engage view, and disassociate Participants from a Sequence if some update caused them to meet their related Sequence's exit criteria.

Disassociating Participants

Although Participants are disassociated via triggers, there are instances where a Participant (Lead or Contact) can be updated to meet a Sequence's exit criteria without triggers running. One such scenario is when a non-sequence user updates a Lead or Contact. Since Sequence triggers don't execute on non-Sequence user updates, the Participant will not be exited from the Sequence in this case.

Schedule

The Participant batches run every 30 minutes via the GuidedSelling-CoreScheduler scheduled job (formerly called Cadence). 

Responsibilities

  • The concerns of the batches in this process are:
  • Checks if any Participant meets their Sequence exit criteria
  • Performs Automatic Native Email Actions via the Revenue.io API
  • Sets the "Is_Initiated", "Actual_Execution_Date" values on the Participant Action Sets the "Show on Engage" field of scheduled Participant Actions

Batch Jobs

  1. PerformLeadActionBatch
  2. PerformCampaignActionBatch
  3. PerformOpportunityActionBatch
  4. PerformOpportunityRoleActionBatch
  5. PerformContactActionBatch

Native Email Status Processes

The Guided Selling Status API Batch process executes as a means to understand (1) which automatic native emails failed to send correctly, and (2) which automatic native emails were sent successfully but weren't updated in Salesforce.

Schedule

The Status API batch process runs every 15 minutes via the GuidedSelling-NativeFallback (formerly called NativeFallbackScheduler)

Responsibilities

The responsibility of the batch process and what it controls are:

  • Calls the Revenue.io Status API to get the status of automatic Native email actions
  • Executes fallback process for unsuccessful emails and sends them via Salesforce, or converts them to manual email actions depending on the email configuration settings set by the Administrator
  • Executes cleanup process for successful actions which were not correctly updated in Salesforce by setting the following field values
    • isActionPerformed=true
    • Email_Sent__c=True
    • Actual_Execution_Date__c=now()
    • Email_Sent_Date__c=now()

Batch Jobs

  1.  NativeFallbackQueue 
  2.  NativeFallbackSchedulerService 
  3.  PerformNativeEmailFallbackBatch

Field Set Update Process

The Field Set Update process ensures that Guided Selling field sets contain any fields which are being used in Sequence entry and exit criteria. For performance reasons, Guided Selling forms queries based on Guided Selling field sets; if a field set is missing a field that is being used in a Contact Sequence’s entry criteria, the application won’t query it, which will result in the Contact failing to enter the Sequence because the application didn’t retrieve the field it needed to evaluate the Sequence criteria at runtime.

Schedule

The Field Set Update process runs every 5 minutes via the GuidedSelling-FieldSet scheduled job (formerly called FieldSetUpdateScheduler).

Batch Jobs

No batches are involved in this process

Participant Delegation Process

The delegation process ensures that Participants (Lead/Contact) owned by Guided Selling users are assigned to matching Sequences. This process enables Guided Selling to quickly associate Participants assigned to sales reps by a non-Guided Selling user (i.e. integration users, LeanData, HubSpot, etc.) to the right Sequence. This doesn’t happen in a trigger context because Guided Selling triggers don’t fire on non-Guided Selling user-initiated transactions.

Schedule

The Participant batch process runs every 5 minutes via the GuidedSelling-ParticipantDelegation scheduled job (formerly called Guided-Selling- Delegation).

Responsibilities

The responsibility of the batch process and what it controls are:

  • Check if any Participant that is owned by a Guided Selling user was last modified after the last delegation job ran. 
  • Route Participants to qualifying Sequence.

Batch Jobs

  1. DelegateParticipantsBatch

Sequence Builder Processes

Saving a Sequence initiates the execution of a handful of batch jobs which are generally responsible for updating the mutated Sequence’s related records (Participants, Participant Actions, Cadence Actions)

Schedule

This process is manually initiated whenever a user edits or creates a Sequence.

Responsibilities

Since the processing varies depending on how the Sequence is being mutated, we’ll describe each job’s specific concern below in lieu of a high-level description.

Components

  • AssociateParticipantsBatch - Sets the Cadence_Id__c, EntranceCriteria_Matched_Date__c and IsActivated__c fields on any newly associated Participants 
  • CreateActionsOnParticipants, CreateActionsOnParticipantsDispatcher, Create_Actions_On_Participants_Batch - Responsible for executing multi-threaded creation of Participant Actions for newly associated Participants 
  • ProcessParticipantActions_Batch, PerformDMLActionBatch - Responsible for updating existing Participant Actions if a change was made to the order of an active Sequence’s actions, or if an action was newly deleted/added to an active Sequence.

Manual Sequence Association Processes

These processes execute when a Guided Selling user manually associates or disassociates a Participant from a Sequence via the Participant Actions overview page (Lead or Contact record page) or a list view.

Schedule

These processes are initiated by a user action.

Responsibilities

The concerns of these processes are:

  • Set values in the Cadence_Id__c, EntranceCriteria_Matched_Date__c and IsActivated__c fields 
  • Insert a Participant Sequence History record for each newly disassociated Participant
  • Insert Participant Actions for newly associated Participants

Batch Jobs

  1. If the number of Participants to process is < 25 records, these processes execute synchronously.
  2. If the number of Participants to process is > 25 records, these processes are facilitated by the same jobs defined in the Sequence Builder Processes page.

Participant Action Processes

Participant Actions are created and assigned to a Participant when it enters a Sequence. To ensure Participant Action data integrity, there are 2 scheduled processes that ensure (a) the correct number of Participant Actions are always present under each Participant, and (b) automatic email Participant Actions are appropriately processed if the Revenue.io server fails to confirm that the email was sent.

Schedule

The Participant Action processes are run every 60 minutes via the HourlyCleanupScheduler job. 

Responsibilities

The responsibility of the batch process and what it controls are:

  • ParticipantActionCountCheckBatch
    • Replace any missing Participant Actions under a Participant which is currently associated to a Sequence, and owned by an active Sequence user.
  • ParticipantActionCleanupBatch
    • Set the isActionPerformed__c field to TRUE for any email type Participant Actions which have a child Task associated, but have their isActionPerformed__c field set to FALSE. This could occur because email action Tasks are inserted as a result of, but in a different transaction than email type Participant Action completion.
    • Create recovery activities for email type Participant Actions which had their isActionInitiated__c field set to TRUE over 2 hours ago, but still haven’t had a child Task created. A failure to create a Task for a completed email action could occur due to complex automation on the Task object in the Salesforce environment, resulting in a CPU Time or Row Lock exception when trying to insert a Task.

Batch Jobs

  • ParticipantActionCountCheckBatch
  • ParticipantActionCleanupBatch

Sequence Drip Processes

The Sequence Drip feature enables Guided Selling administrators to configure a daily limit for the number of Participants per User that can enter a Sequence on a daily basis. This feature is facilitated by the GuidedSelling-HourlyCleanup and GuidedSelling-DailyCleanup jobs.

Schedule

New participants are added to Sequences every night between 12 am and 1 am.

Responsibilities

The responsibility of the batch process and what it controls are:

  • Action Creation for Participants who were pending association due to a drip limit being met for the Sequence to which they were associated.
  • Resetting of the daily counter by which the Guided Selling application keeps count of the number of Sequence Participants a particular Salesforce User has added today, executes every 24 hours.

Batch Jobs

  1. HourlyCleanupScheduler
  2. CleanupScheduler

Was this article helpful?

/