Salesforce License Utilization Report
Monthly flow pulls all Salesforce users, compares active vs. total license count, identifies inactive users (no login in 60+ days), writes utilization report to Excel, and emails IT admins for license optimization.
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
FlowLibs - Salesforce License Utilization Report is a monthly scheduled Cloud Flow that audits Salesforce license usage across your organization. It queries all Salesforce user records, calculates active vs. inactive license counts, identifies users who haven't logged in within a configurable threshold (default 60 days), writes detailed per-user data to an Excel workbook, and sends a formatted HTML summary email to IT administrators for license optimization decisions.
Use Case
SaaS license costs are one of the largest recurring expenses in enterprise IT. Salesforce licenses in particular can cost $150-$300/user/month. Organizations frequently have users who retain active licenses but haven't logged in for months — representing significant waste.
This flow automates the manual process of pulling Salesforce user reports, cross-referencing login activity, and compiling utilization metrics. IT admins receive a monthly email with detailed metrics and an actionable inactive-user list.
The flow is ideal for teams that:
- Total, active, and inactive user counts
- Utilization percentage
- An HTML table of inactive users for immediate review
- A persistent Excel workbook for historical tracking and audit
Flow Architecture
Recurrence
RecurrenceRuns monthly on the 1st at midnight UTC.
Init_varSharePointSiteUrl
Initialize variableReads SharePoint site URL from environment variable flowlibs_SharePointSiteURL.
Init_varExcelDrive
Initialize variableReads Excel drive ID from environment variable flowlibs_ROIExcelDrive.
Init_varAdminEmail
Initialize variableReads admin notification email from environment variable flowlibs_AdminNotificationEmail.
Init_varExcelFile
Initialize variableReads Excel file path from environment variable flowlibs_SfLicenseExcelFile.
Init_varExcelTable
Initialize variableReads Excel table name from environment variable flowlibs_SfLicenseExcelTable.
Init_varInactiveDaysThreshold
Initialize variableReads the inactive days threshold (default 60) from environment variable flowlibs_SfInactiveDaysThreshold.
Init_varTotalUsers
Initialize variableInteger counter initialized to 0; tracks total Salesforce users processed.
Init_varActiveUsers
Initialize variableInteger counter initialized to 0; tracks active Salesforce users.
Init_varInactiveUsers
Initialize variableInteger counter initialized to 0; tracks inactive Salesforce users.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | Root SharePoint site URL where the utilization workbook lives. |
| flowlibs_ROIExcelDrive | String | <configure> | SharePoint document library drive ID hosting the Excel workbook. |
| flowlibs_AdminNotificationEmail | String | alerts@yourcompany.com | Primary admin email recipient for the monthly utilization report. |
| flowlibs_AdminAlertRecipientEmail | String | alerts@yourcompany.com | CC recipient for alert emails. |
| flowlibs_SfLicenseExcelFile | String | /FlowLibs - Salesforce License Utilization.xlsx | Path (relative to the drive) to the Salesforce license utilization Excel workbook. |
| flowlibs_SfLicenseExcelTable | String | LicenseUtilization | Name of the Excel table that receives per-user utilization rows. |
| flowlibs_SfInactiveDaysThreshold | String | 60 | Days since last login at which a Salesforce user is flagged as inactive. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Salesforce | shared_salesforce | GetItems (Query the User object for all license holders) |
| Excel Online (Business) | shared_excelonlinebusiness | AddRowV2 (Write per-user rows to the utilization workbook) |
| Office 365 Outlook | shared_office365 | SendEmailV2 (Send the formatted HTML utilization report) |
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.
- Changing the schedule
- Modify the Recurrence trigger. Change interval and frequency to adjust timing. Add schedule.hours and schedule.minutes for specific run times.
- Adjusting the inactive threshold
- Update the flowlibs_SfInactiveDaysThreshold environment variable. The flow uses this value in the dateDifference() calculation to determine Active vs. Inactive status.
- Adding more Salesforce fields
- Edit the Get_All_Salesforce_Users action's $select parameter to include additional fields (e.g., Department, ManagerId). Then update the Excel table columns and the Write_User_Row_To_Excel action to map the new fields.
- Customizing the email report
- Edit the Compose_Email_Body action to modify the HTML template. The report uses inline CSS for email client compatibility. Add/remove sections, change colors, or modify the summary metrics as needed.
- Filtering specific license types
- Add a Condition action after Get_All_Salesforce_Users (inside the loop) to filter by UserType or Profile.Name. This allows reporting on specific license tiers only.
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.01Days since login calculation
Computes whole days between the user's LastLoginDate and now; falls back to 1900-01-01 when LastLoginDate is empty so brand-new accounts read as long-inactive.
EXPR.02User status determination
Returns 'Active' only when the Salesforce user IsActive flag is true AND days since login is within the configured threshold; otherwise 'Inactive'.
EXPR.03Utilization percentage
Active-user share of total users, expressed as a percentage. Guards against divide-by-zero when no users are returned.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.