Sync Hive ridership data to Salesforce every 5 minutes

What it does

When a scheduled job runs every 5 minutes, this automation queries Hive for ridership data and calculates statistics per customer. It then creates Ridership records in Salesforce with rider counts, average costs, and total amounts.

Who it's for

Data and analytics teams who need ridership metrics from Hive synced to Salesforce without manual updates.

How teams use this

Track rider metrics by customer

Sync ridership counts and average costs from Hive to Salesforce every 5 minutes so the sales team sees up-to-date rider activity per Account without manual data entry.

Monitor ride cost trends

Use the average cost calculations in Salesforce to identify which customers have the highest or lowest ride expenses. This helps finance teams spot pricing or usage patterns.

Add rider names to Ridership records

Include rider names in the Ridership record creation so each ride is attributed to a specific person, not just aggregated by customer. This requires storing the rider name field in the custom object.

Filter high-value customers only

Add a condition to create Ridership records only for customers with total ride amounts above a threshold. This keeps Salesforce focused on the most valuable accounts.

How it works

  1. Start the sync every 5 minutes. A scheduled job runs every 5 minutes to pick up new rows in the Hive ridership table and prepare them for Salesforce.
  2. Query ridership statistics from Hive. Run custom SQL queries in Jdbc to calculate rider counts, average ride costs per rider and customer, ride counts, and total ride amounts grouped by customer.
  3. Search for matching Accounts. Search Salesforce for Account records that match the customer names from the Hive query results so the right data attaches to each Account.
  4. Create Ridership records in Salesforce. For each customer in the query results, create a Ridership record in Salesforce with the calculated statistics attached to the matching Account.