Skip to content

feat: @W-19594198 - Add CSV export to assessment and migration reports#489

Merged
mdmehran-qureshi merged 7 commits into
developfrom
mdmehran.qureshi/W-19594198
May 29, 2026
Merged

feat: @W-19594198 - Add CSV export to assessment and migration reports#489
mdmehran-qureshi merged 7 commits into
developfrom
mdmehran.qureshi/W-19594198

Conversation

@mdmehran-qureshi
Copy link
Copy Markdown
Collaborator

@mdmehran-qureshi mdmehran-qureshi commented May 21, 2026

Summary

  • Adds CSV export functionality for Custom Labels assessment and migration reports (W-19594198)
  • Custom Labels HTML reports only show error/warning records (due to volume of 10K+ labels), but the CSV export includes ALL records (success + errors) for offline review
  • Generates server-side CSV files (customlabel_assessment_export.csv / customlabel_migration_export.csv) at report-build time with all labels
  • Adds "Export CSV" button to both assessment and migration report templates
  • For other components (OS, IP, FC, DR, Apex, LWC, etc.), the export scrapes visible table rows (respects filters/search)
  • Includes proper CSV escaping, HTML tag stripping, and UTF-8 BOM for Excel compatibility

Test plan

  • Run sf omnistudio migration assess with Custom Labels and verify "Export CSV" button appears
  • Click "Export CSV" on Custom Labels report — verify it downloads a CSV with ALL labels (including "Ready for migration" records not shown in HTML table)
  • Verify CSV has correct headers: Name, Package - Id, Package - Value, Core - Id, Core - Value, Assessment Status, Summary
  • Open exported CSV in Excel and verify UTF-8 characters and HTML-stripped values render correctly
  • Run sf omnistudio migration migrate with Custom Labels and verify "Export CSV" downloads a CSV with all migration results
  • For non-Custom-Label reports (e.g., OmniScript, FlexCard), click "Export CSV" and verify it exports only visible/filtered rows from the table
  • Apply filters/search on a non-Custom-Label report, then export — verify only filtered rows appear in CSV

🤖 Generated with Claude Code

@mdmehran-qureshi mdmehran-qureshi requested a review from a team as a code owner May 21, 2026 12:17
@mdmehran-qureshi mdmehran-qureshi self-assigned this May 22, 2026
mdmehran-qureshi and others added 4 commits May 22, 2026 15:29
…gration reports

Add an "Export CSV" button to the report header bar that exports visible
table data (respecting active filters and search) to a downloadable CSV file.
Supports multi-row headers (e.g., Custom Labels with Package/Core sub-columns)
by flattening them into a single header row.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…igration reports

Custom Labels reports only show error/warning records in the HTML table (due to
volume), but customers need all records for offline review. This generates a
server-side CSV file with ALL labels (including success records) and wires the
Export CSV button to download it directly.

- Assessment: fetch all labels via allLabels pipeline, generate customlabel_assessment_export.csv
- Migration: store all clone API results in allRecords Map, generate customlabel_migration_export.csv
- Client JS: exportTableToCSV() detects props.csvFile and triggers file download
- Other components continue using existing table-scraping export (all records visible in HTML)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n.lock

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Removes duplicate private methods from AssessmentReportHelper and
ResultsBuilder by moving them to a shared stringUtils module.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mdmehran-qureshi mdmehran-qureshi force-pushed the mdmehran.qureshi/W-19594198 branch from da709b9 to 10fe7dc Compare May 22, 2026 09:59
Comment thread src/utils/resultsbuilder/index.ts Outdated
Copy link
Copy Markdown

@shaurabh-tiwari-git shaurabh-tiwari-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for these changes, rest looks good to me.

mdmehran-qureshi and others added 2 commits May 25, 2026 15:40
Moves hardcoded CSV filename strings to Constants for reuse and
maintainability per PR review feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add stringUtils.test.ts: tests for stripHtml, escapeCSVValue, escapeHtml,
  and formatUnicorn functions
- Update customLabels.test.ts: verify allLabels includes all processed labels
  (success + errors) for CSV export while labels only contains warnings/errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread src/utils/resultsbuilder/index.ts
Comment thread src/javascripts/reportGeneratorUtility.js
…tates)

Button shows "Exporting..." while processing, "✓ Exported" (green) on
success, or "Export failed" (red) on error. Resets to original state
after 2-3 seconds. Wraps export logic in try/catch to handle failures
gracefully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
URL.revokeObjectURL(url);
showExportSuccess(exportButton);
} catch (error) {
console.error('CSV export failed:', error);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdmehran-qureshi Once export is failed, can we re-export or button will be changed to export failed only

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will show Export after 2-3 sec

<!-- Export to CSV button -->
<button class="export-csv-button" onclick="exportTableToCSV('report-table')" title="Export to CSV">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdmehran-qureshi Does the export button only visible for custom labels as we added in template?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the Export CSV button is visible on all component reports (OmniScript, FlexCard, IP, DataMapper, Apex, LWC, etc.) — not just Custom Labels. It's placed in the shared assessmentReport.template and migrationReport.template.

The behavior differs by component:

  • Custom Labels: Downloads a pre-generated CSV file containing ALL records (including success records not shown in HTML)
  • All other components: Scrapes the visible table rows and exports them as CSV (respects active filters/search)

This is intentional — the WI specifically called out Custom Labels needing a separate full-data CSV because the HTML only shows errors. Other components already show all records in their HTML table, so scraping the table gives the complete picture.

@mdmehran-qureshi mdmehran-qureshi merged commit b1c4f79 into develop May 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants