Ask Salesforce questions in Microsoft Teams with a read-only Copilot agent
Reps and managers ask questions about deals and quotes in their work chat and get answers straight from the CRM, limited to what they are allowed to see. No digging through reports.
Paste this into ChatGPT, Claude or your agent tool. See the prompt
- RevOps Reporting
- intermediate
- RevOps
- AE
- Category
- RevOps Reporting
- Difficulty
- Intermediate
- Est. cost
- Not stated by source
Works with
Problem
Reps and managers want quick answers about quotes and opportunities without opening reports. An agent that guesses CPQ field names gets it wrong and makes many tool calls.
Setup
A Copilot Studio agent with web knowledge removed has one tool, the Salesforce connector's Execute a SOQL query, which keeps it read-only. The query input is set to fill with AI, end-user authentication makes each person see only their own permissions, and the agent instructions list the org's field API names plus example queries. It is published to Microsoft Teams.
Prompt
Starter prompt by The GTM Agent Weekly, written from the setup described on this page. It is not the source's own prompt; see the source link below for their write-up.
# ROLE
You answer questions about our Salesforce data in chat. You have one tool: run a read-only
SOQL query as the signed-in user. You never change data.
# FIELD REFERENCE (fill in)
- Opportunity: Name, StageName, Amount, CloseDate, OwnerId, {{CUSTOM_FIELDS}}
- Account: Name, Industry, OwnerId, {{CUSTOM_FIELDS}}
- Stage values: {{STAGE_VALUES}}. Fiscal year starts: {{FY_START}}.
# EXAMPLE QUERIES
- "My open deals closing this month": SELECT Name, Amount, CloseDate, StageName FROM Opportunity
WHERE OwnerId = '{{CURRENT_USER_ID}}' AND IsClosed = false AND CloseDate = THIS_MONTH
- {{MORE_EXAMPLES}}
# HOW TO WORK
1. Turn the question into one SOQL query using only the fields above.
2. Run it. If it errors, fix the query once; if it fails again, say so.
3. Answer in plain language with a short table. Mention the filter you used.
# GUARDRAILS
- Read-only. No web answers, no guessing beyond the query results.
- If results are empty, say "no records found" and suggest a broader question.
- Keep results to {{MAX_ROWS}} rows; offer to narrow down. Replace every {{PLACEHOLDER}} before running. Works with any capable LLM and runner.
Tools
Steps
- Create the agent and remove web search from its knowledge sources.
- Add only the Execute a SOQL query tool from the Salesforce connector.
- Use end-user authentication so each user's Salesforce permissions apply.
- Put the field list and example queries in the agent's Instructions box.
- Test in a fresh chat after each change, then publish to Teams.
Results
Practitioner walkthrough; the author reports fewer tool calls per question once the field list moved into instructions. Anecdotal.
What goes wrong
Gotchas
- Field lists put in the tool's description did not reliably reach the agent; the Instructions box did.
- A shared connection gives everyone your Salesforce access; fine for a test, wrong for a company.
- Where the agent is available in Teams cannot be changed after publishing.
Get 5 like this every week, free.
Real agent setups with sources and failure modes, in one short weekly email.
Free. One email a week. Unsubscribe anytime.
Source and credit
Sahl Ebrahim, DEV Community · newsletter
Source dated 2026-10-11 · last reviewed 2026-10-11. Summarized in our own words; see the source for details.