Available in version 2.146 and up
The Generate Invoice
flow action allows you to create invoices based on various parameters directly within Salesforce flows. Below is a detailed guide on how to implement this feature, divided by invoice type.
General Requirements
For every invoice type, the following fields are required:
- Invoice Date: The date of the invoice.
- Project ID: The ID of the project associated with the invoice.
- Invoice Type: The type of the invoice. Valid Options are: fixedAmount, timeEntry, billEvents, expensesOnly, or blankInvoice
- AP Config Id: The Id of the Accounts Payable Configuration.
- Billing Config Id: The Id of the Billing Configuration.
Invoice Types and Required Fields
1. Fixed Amount
For invoices with a fixed amount, the following fields are required:
- Invoice Date: The date of the invoice.
- Invoice Amount: The total amount that should be invoiced.
- Include Expenses: Flag to indicate whether to include expenses in the invoice.
2. Time Entries/Billing Events
For invoices based on time entries or billing events, the following fields are required:
- Invoice Date: The date of the invoice.
- Start Date: The start date for the invoice period.
- End Date: The end date for the invoice period.
- Include Expenses: Flag to indicate whether to include expenses in the invoice.
- Include Billing Events: Flag to indicate whether to include uninvoiced billing events.
3. Expenses Only
For invoices based solely on expenses, the following fields are required:
- Invoice Date: The date of the invoice.
- Start Date: The start date for the invoice period.
- End Date: The end date for the invoice period.
- Include Expenses: Flag to indicate whether to include all uninvoiced expenses.
4. Billing Events Only
For invoices based solely on billing events, the following fields are required:
- Invoice Date: The date of the invoice.
- Start Date: The start date for the invoice period.
- End Date: The end date for the invoice period.
5. Blank Invoice
For creating a blank invoice, only the following field is required:
- Invoice Date: The date of the invoice.
Example Flow Setup
Follow these steps to set up a flow using the GenerateInvoice
feature:
- Create a New Flow:
- Go to Salesforce and create a new flow.
- Add a Screen Element:
- Add a screen element to capture the required fields based on the invoice type you want to generate.
- Add an Apex Action:
- Add an Apex Action element and select
Generate Invoice
as the Apex method. - Map the input fields from your flow to the fields.
- Add an Apex Action element and select
- Set Up Parameters:
- Ensure that all required fields for the chosen invoice type are provided.
- For example, for a Fixed Amount invoice, make sure to pass
Invoice Date
,Invoice Amount
, andInclude Expenses
.
- Complete the Flow:
- Add any additional elements to your flow as needed, such as email notifications or updates to related records.
- Activate the Flow:
- Once the flow is set up and tested, activate it to make it available for use.