More teams are asking an AI assistant to do the jobs they used to click through by hand, and producing documents is an obvious one. A sales manager wants the renewal letter for the account they're looking at. A fundraiser wants a thank-you letter on file for every gift over a certain amount. It's a sensible thing to automate. But for many organisations, especially those that hold personal or sensitive information, the question that matters is where that information ends up along the way.
Weaver's answer is simple: automation shouldn't cost you control of your data. Weaver builds every document inside your Salesforce org and saves it as an ordinary Salesforce File. It gives Flow a standard action, so you can make documents from automation you build yourself, and you can hand that same action to Agentforce. At no point does Weaver send your record data, your templates or your finished documents to an AI model, or to any service outside Salesforce.
Weaver keeps your data, documents and templates in Salesforce. An AI agent can ask Weaver for a document, but it never gets to read one.
A record changes, someone clicks a button, or a user asks Agentforce for a document.
Your flow decides which template to use and what to do with the result.
Weaver merges the record into your template and makes the file, all inside your org.
A PDF, Word, Excel or email document, saved to a record or sent by email.
What the Weaver action can do
Once Weaver is installed, you'll find an Apex action called WeaverFlows in Flow Builder. You give it a template, a record and the kind of output you want, and it reports back whether it worked. It takes one setting, the action type, that chooses what happens to the finished document:
| Action type | What it does | Also needs |
|---|---|---|
saveToRecord | Saves the document as a file on the same record | Document type |
saveToParent | Saves the document to a different record, such as the Account behind an Opportunity | Document type, parent record Id |
saveToFeed | Posts the document to the record's Chatter feed | Document type |
sendAsMail | Sends the template as the body of an email | An email address, or a Contact, Lead or User Id |
sendAsAttachment | Attaches the document to an email built from one of your Salesforce email templates | Document type, the recipient's Contact, Lead or User Id, the email template Id |
Every action also needs templateId, the Id of your Weaver template, and recordId, the record whose data goes into the document. The document type can be PDF, Word, Excel or Email. You can name the file with fileTitle; if you leave it out, Weaver uses the template's name. When everything goes to plan the action returns the word Success, and otherwise it returns a message explaining what stopped it.
Part 1: make a document from a flow
Let's take a common case. When an Opportunity is marked Closed Won, you'd like a PDF order confirmation saved to it automatically, without anyone having to remember.
- Open your template in the Weaver Designer and check it looks right with a real Opportunity. Then copy the template's record Id from the address bar of its Weaver Template record. It's the 18-character code that starts the address after the object name.
- In Setup, go to Flows and create a new record-triggered flow on Opportunity. Set it to run when a record is updated, with the condition that Stage equals Closed Won, and choose to run it only when the record is updated to meet the condition, so you get one document rather than one every time the Opportunity is saved.
- Choose to optimise the flow for Actions and Related Records, then add a Run Asynchronously path. Put the Weaver step on that path rather than the immediate one (there's a note below on why).
- On the asynchronous path, add an Action element, search for Weaver and choose
WeaverFlows. Fill in the inputs:actionTypeassaveToRecord,templateIdas the Id you copied,recordIdas the triggering Opportunity's Id,documentTypeasPDF, and, if you'd like, afileTitlesuch as the Opportunity name followed by "Order confirmation". - Save the action's output to a text variable. If you'd like to know when something goes wrong, add a Decision after it that checks whether the result equals
Success, and send yourself a notification when it doesn't. - Activate the flow in a sandbox, move a test Opportunity to Closed Won, and check that the PDF appears under Files a few moments later. Once you're happy, deploy it to production.
Why the asynchronous path? Salesforce doesn't let a page be turned into a PDF in the same moment that a record is being saved. On the immediate path of a record-triggered flow, Weaver would return an error message instead of a document. The asynchronous path runs a few moments after the save, where creating the document is allowed. Screen flows, scheduled flows and the agent flow in Part 2 don't need this, because none of them run while a record is being saved.
The same pattern covers most everyday automation. Swap the action type to sendAsAttachment and the confirmation goes straight to the customer's primary contact instead. Use a scheduled flow to produce monthly statements for every active member. If one flow run asks for documents for many records at the same time, Weaver queues them up and works through them one by one in the background; the action returns Queued for each record, and the outcome of the whole run is written to a Weaver Batch Log record, where you can see how many documents were made and why any failed.
Part 2: let Agentforce create the document
Agentforce agents act through actions, and one kind of action is simply a flow you've built. So the way to give an agent Weaver is to wrap the Weaver action in a small flow that's easy for the agent to understand, and then add that flow to the agent. The agent decides when to use it; Weaver does the work.
- Create a new autolaunched flow (one with no trigger). Add a text variable called
recordIdthat's available for input, and another calledresultthat's available for output. Give both a clear description, such as "The Id of the Account to create the renewal letter for", because the agent reads these descriptions to decide what to pass in. - Add the
WeaverFlowsaction, set up just as in Part 1, with the template and action type fixed andrecordIdtaken from your input variable. Then assign the action's output toresult. Save and activate the flow with a name the agent can make sense of, such as "Create renewal letter". - In Agentforce Builder, open your agent and create a new action. Choose Flow as the reference action type and pick the flow you've just made. Write the action's instructions in plain language: what the document is, when it should be used, and that it saves the letter to the Account's Files.
- Mark the
recordIdinput as required and let the agent show theresultoutput to the user, so they see either a confirmation or Weaver's explanation of what went wrong. - Add the action to a topic that fits, such as account management, and try it in the builder's test panel before you make the agent available to your users.
With that in place, the conversation is about as short as it gets:
If you have several templates, you can either build one small flow for each, which keeps every action's purpose obvious to the agent, or add a template name as a second input and look the template up inside the flow with a Get Records element on Weaver Template. One flow per document is usually easier to get right, and easier for the agent to choose between.
Your data, documents and templates stay out of AI
This is the part we think matters most. When Weaver makes a document, it reads the record, merges it into your template, builds the PDF, Word or Excel file, and saves or emails it, all inside your Salesforce org. None of it is passed to an AI model or to an outside service, whether the request came from a button, a flow or an agent.
When an Agentforce agent uses Weaver, it only ever sees a short status message in return, such as Success. The template and the finished document are never handed to the agent, so they never become part of the conversation and never reach the language model behind it.
To be clear about the one thing that does involve AI: Agentforce uses a large language model to understand what the user types and to decide which action to run. Salesforce handles that part through its Einstein Trust Layer, under the terms of your Salesforce agreement. If you'd rather no AI was involved at all, use Flow on its own. Part 1 of this guide works exactly the same without Agentforce.
A few practical tips
Documents made from Flow or by an agent count towards your plan's monthly allowance in the same way as documents made from a button. If the allowance has run out, the action returns a message saying so instead of making the document.
The two email actions use Salesforce's own email sending, so the daily email limits for your org apply.
The document is made as the user who ran the flow or spoke to the agent, so they need access to the template and to the record's fields.
Build and test the flow in a sandbox, particularly for large runs, since complex templates use more of Salesforce's per-transaction limits.
Agentforce availability depends on your Salesforce edition and licences, so check with your Salesforce account team if you don't see Agentforce Builder in Setup. The Flow action in Part 1 works in any org with Weaver installed.