Attach File Skill
Overview
Use the Attach File skill when your agent should save a generated file directly to the current Salesforce record as a Salesforce File.
This is the right fit when the user wants the file itself, not a PDF wrapper.
Who This Is For
Salesforce admins, solution architects, RevOps teams, and service operations teams who want agents to leave behind reusable files on Accounts, Opportunities, Cases, and similar records.
What The Skill Can Attach
- chart images generated earlier in the same dialogue
- markdown runbooks
- HTML summaries
- plain-text notes or handoff files
Best Use Cases
- attach a rendered chart PNG to an Account, Opportunity, or Case
- create a markdown troubleshooting runbook for a support record
- save an HTML handoff summary for internal teams
- attach a plain-text checklist or action summary to the current record
How It Works
The skill supports two safe source patterns:
- a file artifact that was already produced earlier in the same dialogue
- inline text content created by the agent during the current response
This means the skill is designed for trusted, in-conversation outputs. It is not a general-purpose remote file fetcher.
Safety And Scope
Attach File is intentionally scoped to the current dialogue and current Salesforce record.
That means:
- the agent should only attach artifacts that already exist in the same dialogue
- the agent should not invent S3 keys or signed URLs
- the agent should not try to browse for unrelated files
- the agent should only attach to the current record context in v1
When To Use Attach File vs. Generate PDF
- Use
attach_filewhen the user wants the raw file saved to Salesforce. - Use
generate_pdfwhen the user wants a polished downloadable document. - Use
render_chartwith direct chart attachment when the user wants the chart PNG itself attached to the record.
Prompt Guidance Snippets
Use snippets like these in your custom agent system prompt.
Attach A Generated Markdown File
When the user wants a runbook, checklist, or summary file saved on the current Salesforce record, create the file content and call attach_file.
Use markdown for structured runbooks and text/html only when the user clearly needs HTML.
Attach A Prior Chart Artifact
When the user wants a chart file attached to the current Salesforce record, first create the chart and then attach that generated artifact to the record.
Do not invent storage keys or external file URLs.
Example Agent Behaviors
Example: Support Runbook
User request:
Create a markdown runbook for this case and attach it to the record.
Good agent behavior:
- generate the markdown content
- call
attach_file - attach the markdown file to the current Case
Example: Attach A Chart Image
User request:
Create a bar chart of cases by priority and attach the chart image to this account.
Good agent behavior:
- create the chart first
- attach the resulting PNG to the current Salesforce record
- avoid wrapping it in a PDF unless the user asked for a report
Tips For Better Results
- Tell the agent what kind of file you want: markdown, HTML, plain text, or chart image.
- Tell the agent whether the file should be concise or detailed.
- Keep the request tied to the current record when you want the file saved in Salesforce Files.
- Ask for a PDF only when you want a formatted document instead of the raw generated file.
Troubleshooting
- No file was attached: make sure the agent had current Salesforce record context.
- The wrong file type was attached: tell the agent explicitly whether you want markdown, HTML, plain text, or a chart image.
- The agent tried to use a PDF when you wanted the raw file: update the prompt to tell it to attach the file directly to the record instead of calling
generate_pdf. - The agent referenced a file that does not exist: make sure it first creates the artifact in the same dialogue before trying to attach it.