Technical Guide

This page contains technical information for experienced Salesforce Administrators who are looking for a deeper explanation of the key jobs that run as part of the Emma for Salesforce application.

API Usage

Salesforce has strict governor limits around the use of API calls. The Emma for Salesforce application does not use any API calls when syncing.

There are two types of API calls. Inbound and Outbound. Outbound calls from Salesforce do not count against governor limits.

All syncing to and from Emma are done via outbound calls. For example, if you are sending 100K emails to Emma via any of our syncing methods (e.g. Import Wizard, List Views etc), these do not count against your salesforce API limit.

The only time the Emma for Salesforce application uses inbound API calls is when you:

a) Use a Salesforce List View to perform a bulk operation. E.g. If you select Add Contacts to Emma when working from a List View or via the Import Wizard. This will use up just 1 inbound API call.

b) Navigate to the Sync Settings page. This will use up just 1 inbound API call.

In general, you should not need to worry about the Emma application using up your Inbound API limits.

Background Jobs

The following table provides a list of Emma for Salesforce batch jobs that can run in the background within Salesforce.

BatchDeleteSubscribers

Run as part of the Import Wizard job if the Replace subscribers on list option is enabled under advanced settings. It removes any subscribers from Emma that were not in the Import Wizard report or list view. If there are a large number of subscribers to remove from Emma, this job can take a long time to complete (if this is the case, you could also consider creating a completely separate Subscriber list for the import and deleting the old list - as this could be more efficient).

BatchEmailOptOut

This batch updates the standard Salesforce email opt-out field on the Contact and Lead records based on the member status. It will opt out any members that are unsubscribed in Emma. This job optionally runs as part of the primary sync between Salesforce and Emma. It runs when the following setting (in the General Settings → Options) is enabled: ‘Set Email Opt to true when a contact or lead is Unsubscribed’ and a Contact or Lead is unsubscribed.

BatchSubscriber

Updates Salesforce with the status of any subscribers it finds in Emma. If the Create Rule is enabled it may create and link new subscribers as Contacts or Leads in Salesforce along with any mapped fields. This job runs as part of the primary sync between Salesforce and Emma. If it is unable to update Salesforce (due to restricted fields etc), then a message will be logged under Maintenance Messages.

BatchSubscriberStats

Updates Salesforce members with statistics from the related Emma subscriber list. This job runs as part of the primary sync between Salesforce and Emma.

ConfigBatch

Syncs Emma configuration data with Salesforce. This includes syncing any groups, clients and users with Salesforce. For example, if a user has created a group directly in Emma, then this job needs to have run before it will appear in Salesforce. This job runs as part of the primary sync between Salesforce and Emma.

ScheduleSubscribers

This is a schedulable job that is called from ScheduleSubscriptions when the sync is enabled. It starts the primary sync between Salesforce and Emma.

ImportListViewBatch

Called from the Import Wizard, details from a Salesforce List View into Emma . It can run Import Wizard). The process runs under the scheduled user and as such will only have access to the Salesforce records that user can see.

ImportScheduler

Scheduler for running Import Wizard jobs. It runs hourly under the Salesforce user who requested the scheduled import jobs. This is to ensure the import wizard runs under the owner of the person who started the job (and therefore can only see records available to them).

ProcessAsyncRecords

This is a queuable job that runs if it needs to send Salesforce data to Emma (typically for a single CRUD operation on an Account, Lead or Contact). It can be invoked from a trigger or process builder action.

It will typically only run if there are a) any mapped fields for the subscriber list that the Contact or Lead is associated with, or b) there is an email change on the Contact or Lead.

You can prevent the ProcessAsyncRecords from being called by setting 'Disable Salesforce account, contact and lead triggers' to active under Sync Settings.

ProcessAsyncRecordsBatch

This is a batch job that runs if it needs to send Salesforce data to Emma. It is similar to ProcessAsyncRecords in that it can be invoked under the same conditions. The difference is that it will run when there are multiple records that need to be processed. It works by processing items held in a custom object called Queue_Item__c. It will continue to process these records in atomic transactions. If there are still more items to be processed in the Queue_Item__c object when the batch job completes, it will re-spawn itself.

N.B. If you are running multiple Salesforce Process flows that update the same Salesforce object, this can result in multiple ProcessAsyncRecordsBatch jobs running at the same time. To reduce the chance of this happening, where possible, structure your Salesforce Process flows to update the same Salesforce object.

You can reduce the number of ProcessAsyncRecordsBatch from being run by setting 'Disable bulk triggers for account, contact and lead triggers' to active under Sync Settings. This will result in only the first record in a transaction being processed.

RefreshSubscribers

Clears out the Subscriber List Member (em4sf__Subscription__c) object. It’s called when a full refresh is requested a full re-import Emma data into Salesforce.

ReportToListBatch

Called as part of the Import Wizard, this imports subscriber details from a Salesforce report into Campaign Monitor. It can run as a once off manually initiated job or via a scheduled process (if the user has configured this via the Import Wizard).

Process Builder Invokable Action

The Salesforce Process builder is a powerful tool and when combined with Emma for Salesforce, it provides fine grain control over sending targeted transactional emails to subscribers.

The trade off comes with the complexity of setting up and debugging processes. To help troubleshooting emails not sending, you can test the last step in the process builder action with the code below (E.g. try running the code in the Salesforce Developer Console). This is essentially the code that is called when you use the smart email invokable action in the process builder. If the code below works, then any problems are likely to be related to the fact that the invokable action is not being triggered (E.g. a status on a field used in your Salesforce process builder logic may not be correct etc).

You can also test your Salesforce process by creating a dummy task or updating a value on an object. The code below will help check if the correct Ids were used in the Smart Email Invokable Action in the process builder.

When selecting the object to base the process on in Process Builder, avoid checking "Recursion - Allow process to evaluate a record multiple times in a single transaction?" - this can cause issues with Salesforce governance limits as the action may be called multiple times.

Salesforce Domain Name

The Salesforce Process builder is a powerful tool and when combined with Emma for Salesforce, it provides fine grain control over sending targeted transactional emails to subscribers.

If you are using Salesforce Lightning but don't have a Domain set up, you may receive the error similar to this: No CONTROLLER named js://wbsendit.pagination found

Salesforce requires a domain to be set up in order to use Lightning Components (which are used as part of the Emma for Salesforce application).

Setting up a Salesforce Domain will remove this message.

This video walks you through setting up a Domain Name.

In this article