CV_GeneratePublicUrl_TDTM
Content Version trigger handler/TDTM to generate public Url for files
Table of Contents
Custom Permission | None |
Event | AfterInsert, AfterUpdate |
Object | Content Version |
Related RIO Education Settings | None |
Description
Introduced in v3.14, this class will run on ContentVersion - AfterInsert/AfterUpdate if ‘Generate Public Url’ = TRUE.
It will generate a public Url via the ContentDistribution if one doesn’t exist (or find the existing one if it does), and then populate it into the ‘Public Url’ field on the ContentVersion.
In other words, when a File is uploaded, and the ‘Generate Public Url’ checkbox on the File is checked, this class will automatically generate a publicly accessible Url for the File, and set it on the ‘Public Url’ field.
It will not generate a new public Url if an existing one was already created.
For example, if the ‘Public Url’ field is cleared, and the ‘Generate Public Url’ is unchecked, then checked back again, it will generate the same Url as before.
Use case
In Continuing Education, the Study Offerings (e.g. short courses, workshops, etc.) are listed on the Student Community/Portal. To display images for each Study Offering, a public Url for the image file is required.
Rather than setting up the image Url in Salesforce Classic Mode, this class provides a user-friendly way to load and get Url that can be displayed in the Community.