Generating downloadable content
Apex, Salesforce Functions, and LWC JavaScript can be used to generate a wider range of file type content, such as CSV, JSON, or XML content. Similarly, using an Apex controller and LWC connected to an invoked Quick Action can generate downloadable content as well. The following changes have been made to the FormulaForce application and are included in the code for this chapter:
- Added a new method,
generateSummaryAsCSV
, toRaceService
- Added a new
getCSVContent
method toRaceSummaryController
- Added a new
raceDownloadCSV
LWC - Added a new Quick Action for the LWC, Download Summary, to the Race layout
The new method is added to the existing RaceSummaryController
class. Feel free to review the new Service
method; note that it also uses the ContestantsSelector.selectByRaceIdWithContestantSummary
method introduced in Chapter 7, Application Selector Layer. Here is the new controller method calling it:
@AuraEnabled
public...