Weekly Sales Forecast Report Generator
Salesforce action: GetOpportunityRecords. Weekly flow pulls all open opportunities, calculates weighted pipeline by stage probability, writes forecast breakdown to Excel, and emails the report to sales leadership and finance.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow runs on a weekly schedule (every Monday at 8:00 AM ET), pulls all open opportunities from Salesforce, calculates weighted pipeline values by stage probability, writes a summary row to an Excel workbook on SharePoint, and emails a formatted HTML forecast report to sales leadership and finance stakeholders.
Use Case
Sales leaders and finance teams need a consistent, automated view of the open pipeline each week. This flow eliminates manual CRM exports by pulling opportunity data directly from Salesforce, calculating weighted forecast amounts (Amount x Probability%), logging a weekly snapshot to Excel for trend analysis, and distributing a formatted report via email. It demonstrates: scheduled Salesforce data retrieval, in-flow calculations with Select and Compose, Excel Online row insertion, and HTML email generation.
Flow Architecture
Recurrence Weekly Monday
RecurrenceFires every Monday at 8:00 AM Eastern.
Init varSharePointSiteUrl
Initialize VariableLoads SharePoint site URL from env var flowlibs_SharePointSiteURL.
Init varExcelFilePath
Initialize VariableLoads Excel file path from env var flowlibs_ForecastExcelFilePath.
Init varExcelTableName
Initialize VariableLoads Excel table name from env var flowlibs_ForecastExcelTableName.
Init varRecipientEmails
Initialize VariableLoads report recipients from env var flowlibs_SalesForecastRecipients. Steps 1-4 run in parallel.
Get Open Opportunities
Salesforce GetItems_table_opportunityRetrieves all open opportunities (IsClosed eq false), ordered by Amount desc, selecting Name, StageName, Amount, Probability, CloseDate, OwnerId.
Select Forecast Data
SelectMaps each opportunity to OpportunityName, Stage, Amount, Probability, WeightedAmount (Amount x Probability/100), and CloseDate.
Select HTML Rows
SelectGenerates an HTML table row for each opportunity using object-wrapped output that is later unwrapped into clean HTML.
Compose Opportunity Count
ComposeCounts the total number of open opportunities.
Compose HTML Report
ComposeEnvironment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | Root SharePoint site for the Excel workbook. |
| flowlibs_ForecastExcelFilePath | String | /Shared Documents/FlowLibs - Weekly Sales Forecast.xlsx | Server-relative path to the forecast Excel workbook. |
| flowlibs_ForecastExcelTableName | String | SalesForecast | Name of the Excel table to write summary rows to. Table columns expected: ReportDate, OpenOpportunities, TotalPipeline, ForecastNotes. |
| flowlibs_SalesForecastRecipients | String | sales-leadership@contoso.com;finance@contoso.com | Semicolon-separated email addresses for the weekly forecast report. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Salesforce | shared_salesforce | GetItems_table_opportunity (retrieves open opportunity records) |
| Excel Online (Business) | shared_excelonlinebusiness | AddRowV2 (writes weekly summary row) |
| Office 365 Outlook | shared_office365 | SendEmailV2 (sends forecast report email) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Configure connections
- Open the flow in the designer and authorize each connector (Salesforce, Excel Online, Outlook) with your tenant credentials.
- Set environment variable values
- Update the 4 env vars in the solution to match your environment - especially the SharePoint site URL, Excel workbook path, and recipient email list.
- Prepare the Excel workbook
- Create a workbook at the configured path with a table named per the env var. The table should have columns: ReportDate, OpenOpportunities, TotalPipeline, ForecastNotes.
- Adjust the Salesforce filter
- The $filter on Get Open Opportunities defaults to IsClosed eq false. Add additional filters (e.g., by Owner, Stage, or CloseDate range) as needed.
- Customize the email template
- Edit the Compose HTML Report action to modify the report layout, colors, or add additional metrics.
- Change the schedule
- Edit the Recurrence trigger to change frequency, day of week, or time zone.
- Turn on the flow
- Once all connections are authorized and env vars are configured, toggle the flow from Off to On.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Weighted Amount calculation
Multiplies opportunity Amount by Probability/100 to produce a weighted pipeline value; coalesce guards against nulls.
EXPR.02Currency formatting
Formats the Amount field as a currency-style string with two decimals for the HTML report.
EXPR.03Opportunity count
Counts the rows produced by the Select Forecast Data action, used in the Excel summary row.
EXPR.04Dynamic email subject
Appends today's date in yyyy-MM-dd format to the email subject for easy identification.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.