Sanka

Salesforce Opportunity to invoice workflow

Import Salesforce Opportunities into Sanka Orders, then create invoice drafts with workflow checks, mappings, and AI-safe validation.

Last updated: May 28, 2026

Use this guide when Salesforce Opportunities should become Sanka Orders and those orders should create invoice drafts through workflows. It explains the flow, required mappings, expected behavior, troubleshooting, and AI-safe checkpoints so support teams can distinguish setup issues from product bugs.

What you'll achieve

The flow uses two workflows:
  1. Import Salesforce Opportunities into Sanka Orders on a schedule or controlled run.
  2. Create invoice drafts from Orders when the Order is created or reaches the required status.
This flow should not send invoices automatically unless your team has explicitly configured and tested a separate send action. Creating an invoice draft is safer than sending a customer-facing invoice immediately.

Prerequisites

  • Salesforce and Sanka are connected.
  • The connected Salesforce user can view the Opportunities, Accounts, Contacts, fields, and record types used in the mapping.
  • Sanka Orders and Invoices are enabled for the workspace.
  • Required Order fields are mapped, such as customer, owner, line items, amount, currency, status, and Opportunity ID.
  • Required Invoice fields are available, such as customer, amount, invoice date, due date, currency, tax, and line items.
  • A unique Salesforce Opportunity identifier is stored on the Sanka Order to prevent duplicate imports and duplicate invoices.
  • The team has decided whether approval is required before invoice creation or before invoice sending.

Ask AI to review the flow

Before enabling the workflows, ask AI to review the mapping and downstream effects. Do not ask AI to enable the workflow, create production invoices, or send invoices until a human has reviewed the plan.
Sample prompt
/sanka Review this Salesforce Opportunity to Sanka Order to invoice workflow before it runs. Check Salesforce field visibility, Opportunity to Order mapping, unique Opportunity ID, customer and line-item mapping, Order trigger conditions, invoice required fields, duplicate invoice prevention, approval requirements, and history I should check after the test run. Do not enable the workflow, create production invoices, or send invoices yet.

Workflow A: Import Opportunities into Orders

  1. Open Workflow in Sanka and create a workflow.
  2. Choose a Time trigger or another controlled trigger for the import.
  3. Add an import action for Salesforce records.
  4. Select Salesforce as the connected service.
  5. Map Opportunity fields into Sanka Order fields.
  6. Include the Salesforce Opportunity ID or another unique identifier on the Order.
  7. Filter the import to the intended Opportunities, such as the right stage, owner, date range, or record type.
  8. Save the workflow and test with one known Salesforce Opportunity.
Expected success state: one Sanka Order is created or updated from the intended Salesforce Opportunity, the source identifier is stored, the customer and line items are correct, and import history shows the result.

Workflow B: Create invoice drafts from Orders

  1. Create a second workflow.
  2. Choose an Order event trigger, such as Order created or Order status changed.
  3. Add conditions so only Orders imported from the intended Salesforce flow create invoices.
  4. Add a create-record action for Invoice.
  5. Use data from the Order trigger to populate customer, line items, amount, currency, dates, and owner.
  6. Add a condition or status flag that prevents creating a second invoice for the same Order.
  7. If your process requires review, add an approval action before invoice creation or before invoice sending.
  8. Save the workflow and test with the Order created by Workflow A.
Expected success state: one invoice draft is created from one eligible Order, linked back to the Order where supported, and visible in invoice and workflow history.

Verify the end-to-end flow

  1. Choose or create one Salesforce Opportunity for testing.
  2. Run or wait for the Opportunity import workflow.
  3. Confirm the Sanka Order was created or updated.
  4. Confirm the Order has customer, line items, amount, currency, owner, status, and Salesforce Opportunity ID.
  5. Confirm the invoice workflow ran once.
  6. Confirm the invoice draft has the expected customer, line items, amount, invoice date, due date, and source Order.
  7. Check workflow history, action history, and record history before enabling the flow more broadly.
Search Sanka...
Opportunity to invoice checkpoints

Logs

Search logsAll actionsAll dates
ID / ActionDateTarget / ItemChangeActor
1Salesforce mapping reviewedMay 23, 2026Opportunity import workflowOpportunity ID, account, amount, owner, and line items mapped to OrderWorkspace admin
2Order import testedMay 23, 2026Test OpportunityOne Sanka Order created with Salesforce source IDOperations user
3Invoice draft verifiedMay 23, 2026Invoice workflowOne invoice draft created from the imported Order and reviewed before sendingFinance lead

Review these checkpoints before treating missing invoices or duplicate invoices as product bugs. Most issues come from Salesforce field visibility, mapping, workflow conditions, required invoice fields, or duplicate-prevention rules.

Troubleshooting

IssueWhat to check
Orders are not importedCheck Salesforce connection, connected user field visibility, import filters, mapping, and import history.
Orders import without line itemsConfirm Opportunity product or line-item data is visible and mapped to the expected Order line fields.
Invoices are not createdConfirm the Order trigger fired, workflow is enabled, conditions matched, and required invoice fields are present.
Duplicate invoices are createdCheck whether the Opportunity imported twice, whether the Order trigger fired twice, and whether the workflow has a duplicate-prevention flag or condition.
Invoice values are wrongCompare Salesforce Opportunity fields, Sanka Order fields, copied invoice fields, currency, tax, and line-item mapping.
AI wants to change codeAsk AI to compare connection, mapping, workflow history, action history, required fields, and permissions before proposing a code change.