Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 3.52 KB

File metadata and controls

56 lines (41 loc) · 3.52 KB

Salesforce Data Usage Analyzer

This tool uses the Salesforce API to process Custom and Standard Objects and every individual field, then outputs a CSV and an interactive HTML dashboard of field usage (filled vs empty counts, usage %, and charts).

Documentation: For setup, config reference, and dashboard guide, see the Wiki. The wiki is the GitHub wiki repo, linked as the .wiki submodule; after cloning the main repo, run git submodule update --init to populate .wiki for local wiki editing.

Requirements

  • Python 3.7+
  • requests (see requirements.txt)

Quick start

  1. Config: Copy the example and add your org and Connected App details.

    cp configs/config_example.json configs/config_myorg.json

    Edit configs/config_myorg.json (instance URL, client_id, client_secret, callback port, mode, objects, etc.). See the Wiki – Config reference for all options. Use exclusion_objects to skip objects that are not queryable or not needed (e.g. ApexClass, SetupAuditTrail, TabDefinition); the tool excludes many system/event objects by default and, after a run, writes any failed objects to temp/failed_objects.json so you can add them to exclusion_objects for the next run.

  2. Install: pip install -r requirements.txt (recommend a virtual environment).

  3. Run:

    python data_usage_analyzer.py --config configs/config_myorg.json

    Or headless: python data_usage_analyzer.py --silent --config configs/config_myorg.json

  4. Output: The script writes to output/ and then opens the dashboard in your browser.

    • CSV: output/field_usage_YYYYMMDD_HHMMSS.csv (and per-object CSVs in full runs).
    • JSON: output/field_usage_YYYYMMDD_HHMMSS.json — combined field-usage data keyed by object.
    • Manifest: output/manifest.json — lists the latest run and all available runs for the dashboard Data menu.
    • Dashboard: Served at http://localhost:8000/static/ (port 8000). You can switch between runs via the header Data menu and filter by Objects and Usage %.

Dashboard

The dashboard (SLDS-styled single-page app in static/) includes:

  • Header: Data run selector, Objects filter (multi-select on main view; object switcher on object detail), back button, Help (wiki link).
  • Main view: Sortable object table (record counts, field counts, most/least used %), exclude list, charts (record counts by object, least utilized fields), toolbar (Usage % min/max, “View all low-usage fields”, “Export exclusion list”).
  • Object view: Per-object field table with Usage % and field-type filters, highlight panel (total/custom/standard/managed), “Fields to delete” list for export.
  • Low-usage view: All fields below the Usage % max threshold in one table.

Details and screenshots: Wiki – Dashboard.

Project layout

├── configs/
│   └── config_example.json   # Example config (copy and edit)
├── data_usage_analyzer.py    # Main script (OAuth, API, CSV/JSON, dashboard server)
├── requirements.txt
├── static/                   # Dashboard UI (HTML, JS, CSS, Chart.js, SLDS)
├── output/                   # Created at run: CSV, JSON, manifest.json
├── .wiki/                    # Optional: clone of GitHub wiki repo for editing
└── README.md