Quick Overview
This workflow runs weekly to find cross-sell white space in Salesforce enterprise accounts by comparing Closed Won products to an ERP product catalog, then uses Google Gemini to generate the top opportunities, creates a follow-up Salesforce Task, emails the account owner via Gmail, and logs results in Google Sheets.
How it works
- Runs every Monday at 06:00 using a schedule trigger.
- Pulls Salesforce accounts with AnnualRevenue greater than $100,000 and processes them in batches.
- For each account, queries Salesforce Closed Won Opportunity Line Items and fetches the full ERP product catalog over HTTP.
- Calculates product coverage and white space (catalog items not yet purchased) and builds an account context summary.
- Checks a Google Sheets “memory” tab to skip accounts already processed in the current ISO week.
- Sends the account context and white space list to Google Gemini to produce a JSON response with the top 3 expansion opportunities plus a suggested Salesforce task and HTML email.
- If the AI response parses successfully, creates a Salesforce Task, emails the account owner via Gmail, and appends the outcomes to Google Sheets; otherwise, logs the parse error and continues to the next account.
Setup
- Add Salesforce OAuth credentials and ensure OpportunityLineItem records include Product2.Name for Closed Won opportunities.
- Update the ERP catalog HTTP endpoint (the template uses dummyjson.com for demo data) to point to your real product catalog API.
- Add Google Gemini (PaLM/Gemini) API credentials and confirm the selected Gemini model name matches what your account can access.
- Add Google Sheets credentials and set up a spreadsheet/tab with columns such as account_id and processed_week (plus any reporting columns you want to retain) to track weekly processing.
- Add Gmail OAuth credentials and ensure Salesforce Account Owner emails are populated so messages can be sent to the right recipients.
- Adjust the cron expression in the schedule trigger if you want a different run day/time.