Acquiring Zengain Signals

Each Account in Salesforce corresponds to a unique Customer in Zengain. This uniqueness is ensured through the inclusion of a custom field, ZGCustomerID, in each Salesforce account. This is the Zengain customer ID, which serves as a unique customer identifier.

Customer engagement data is captured and stored in Zengain as signals. The corresponding datatype in Salesforce is a custom field ZGSignal in the Account object. The ZGSignal data is updated automatically every 15 minutes from Zengain using a triggered, automated flow with built-in duplicate (by customer ID) rejection. Signals cannot be altered in Zengain, and so there is no need to consider updating existing ZGSignal records.

We check the date of the last signal record stored in ZGSignals Custom Object, and call ZG REST API to get all the records from this date and time minus one hour. We then insert these into the ZGSignals object, rejecting duplicates.

Here, we will see how to set up scheduled jobs in Salesforce to perform this task.

In the quick find box, search for the Scheduled Jobs page:

Go to this page and click the Schedule Apex button as shown:

We will now create a job that acquires the latest Zengain signal every hour on the hour. Give the job a suitable name and select the Apex class RunGetZGSignalsFlow. Choose the Cron Expression schedule option and, in the Cron Expression textbox, paste "0 00* * * ?" without quotes. Then click the Save button.

Now do the same for 15, 30 and 45 minutes past the hour by creating corresponding scheduled jobs in the same way, differing only in the Job Name and in the Cron Expression, where the double zero 00 should be replaced by the corresponding number of minutes past the hour, e.g. "0 15* * * ?"

Last updated

Was this helpful?