Workflow Structure
- Trigger: Record is Updated (Opportunity)
- Filter: Stage = Closed Won
- Search Record: Get Company details
- Code (optional): Format payload
- HTTP Request: Send to invoicing system
Step 1: Set Up the Trigger
- Create a new workflow
- Select Record is Updated trigger
- Choose Opportunity as the object
Step 2: Filter for Closed Won
Add a Filter action to only continue when the deal is won:| Setting | Value |
|---|---|
| Field | Stage |
| Condition | Equals |
| Value | CLOSED_WON (or your stage name) |
Step 3: Get Company Details
The Opportunity record may not include all Company fields you need for the invoice. Add a Search Record action:| Setting | Value |
|---|---|
| Object | Company |
| Match by | ID equals {{trigger.object.companyId}} |
Step 4: Format the Payload (Optional)
If your invoicing system expects a specific format, add a Code action:Step 5: Send to Invoicing System
Add an HTTP Request action:| Setting | Value |
|---|---|
| Method | POST |
| URL | Your invoicing API endpoint |
| Headers | Authorization: Bearer YOUR_API_KEY |
| Body | {{code.invoice}} or map fields directly |
Example: Stripe Invoice
Example: QuickBooks Invoice
Complete Workflow Summary
| Step | Action | Purpose |
|---|---|---|
| 1 | Trigger: Record Updated | Fires when any Opportunity changes |
| 2 | Filter | Only proceed if Stage = Closed Won |
| 3 | Search Record | Get full Company details for billing |
| 4 | Code | Format data for invoicing API |
| 5 | HTTP Request | Create invoice in external system |
Tips
- Store external IDs: Save the invoice ID returned by the API back to the Opportunity using an Update Record action
- Error handling: Add a branch to send a notification if the HTTP request fails
- Test first: Use your invoicing system’s sandbox/test mode before going live
Related
- Generate a PDF from Clara — attach generated PDFs to records
- Workflow Triggers
- Workflow Actions
- Closed Won Automations