← Back to directory
Sales Medium to set up AI workflow Personalize/Recommend

Generate Salesforce Opportunity Next Steps

Source reviewed Updated 2026-07-07

Daily agent finds open Salesforce opportunities missing a next step, generates an action plan with Gemini, posts it to Slack.

What it does

You get daily Slack notifications with actionable plans for any open Salesforce deals missing a next step. This agent analyzes your deal details using Google Gemini to suggest specific actions and automatically updates those records in Salesforce.

Step by step

  1. Configure a scheduled flow in Salesforce that triggers daily to query Opportunity records where StageName is not null and NextStep__c is blank.
  2. Set up an HTTP callout or Apex action to send the opportunity JSON payload to the Google Gemini API endpoint with the system prompt template.
  3. Parse the JSON response from Gemini to extract the recommended text for the next step field.
  4. Update the Opportunity record in Salesforce by writing the extracted text into the NextStep__c custom field.

Where the LLM does the work

  • Craft the system prompt that instructs Gemini to analyze deal context and generate concise, actionable sales advice based on the provided opportunity data.
  • Define the output format constraints for the LLM response to ensure it returns only the next step text without markdown or extra commentary.
  • Design the Slack message template that summarizes the opportunity name, account, and the AI-generated suggestion for human review.

Watch out for

The LLM might generate overly verbose text that exceeds Salesforce field character limits so truncate the response before saving it.
Salesforce API governor limits may be hit if many opportunities are processed at once so batch the updates using Database.update with false for allOrNone.
Slack posting can fail if the channel ID is invalid or permissions change so verify the integration user has access to the target channel.

Tools that fit

Salesforce Service Fetch and update opportunity records
Google Gemini Chat Model LLM Generate next step recommendations
Slack Service Post AI generated recommendations

The agent brief

Everything your agent needs, including the gotchas. Copy it and go.
agent-brief.md
You are helping me build the following AI agent workflow.

## Goal
Generate Salesforce Opportunity Next Steps: Daily agent finds open Salesforce opportunities missing a next step, generates an action plan with Gemini, posts it to Slack.

## Specification
- What it does: You get daily Slack notifications with actionable plans for any open Salesforce deals missing a next step. This agent analyzes your deal details using Google Gemini to suggest specific actions and automatically updates those records in Salesforce.
- Trigger: On a schedule (Scheduled · daily 10:00 AM)
- Autonomy: Fully hands-off
- Expected setup effort: about an afternoon
- Tools/services involved:
  - Salesforce: Fetch and update opportunity records
  - Google Gemini Chat Model: Generate next step recommendations
  - Slack: Post AI generated recommendations

## Known pitfalls, handle each one explicitly in your implementation
1. The LLM might generate overly verbose text that exceeds Salesforce field character limits so truncate the response before saving it.
2. Salesforce API governor limits may be hit if many opportunities are processed at once so batch the updates using Database.update with false for allOrNone.
3. Slack posting can fail if the channel ID is invalid or permissions change so verify the integration user has access to the target channel.

## Reference implementation
https://n8n.io/workflows/16714 (workflow template)
Fetch and inspect this before building. If it matches my stack, adapt it;
if not, rebuild the pattern with my tools.

## Process requirements
1. Before building: ask me which of the listed tools I actually use and
   what my platform is (n8n / Make / code / other). Do not assume.
2. Adapt the pattern to my answers; do not force the reference stack.
3. Address every pitfall above; tell me how you handled each.
4. Provide a test plan I can run before letting this touch real data.
5. Ask before any step that sends messages, modifies data, or spends money.

Source: https://usecasesforagents.com/use-case/generate-salesforce-opportunity-next-steps/ via usecasesforagents.com

Frequently asked questions

Can I use a different CRM than Salesforce?

Yes. Salesforce is only the example CRM in this recipe. The same flow works with Agile CRM, Attio, Close CRM and Freshworks CRM. Swap the CRM connection and keep the rest of the setup as written.

Want this running in your business?

This is what I do. I design and build AI agents like this one, and keep them running. If you want it set up for your team instead of doing it yourself, get in touch.
Get in touch →

Who it's for

Built for sales teams who want the prep work done before they pick up the phone.

Seen in the wild

← Back to directory