feat: @W-19594198 - Add CSV export to assessment and migration reports#489
Conversation
…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>
da709b9 to
10fe7dc
Compare
shaurabh-tiwari-git
left a comment
There was a problem hiding this comment.
Please add tests for these changes, rest looks good to me.
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>
…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); |
There was a problem hiding this comment.
@mdmehran-qureshi Once export is failed, can we re-export or button will be changed to export failed only
There was a problem hiding this comment.
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"/> |
There was a problem hiding this comment.
@mdmehran-qureshi Does the export button only visible for custom labels as we added in template?
There was a problem hiding this comment.
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.
Summary
customlabel_assessment_export.csv/customlabel_migration_export.csv) at report-build time with all labelsTest plan
sf omnistudio migration assesswith Custom Labels and verify "Export CSV" button appearssf omnistudio migration migratewith Custom Labels and verify "Export CSV" downloads a CSV with all migration results🤖 Generated with Claude Code