Loading Student Profile Photos
Description
How to load Student profile pictures?
Resolution
RIO Education uses a Lightning Component - RIO Ed - Picture Panel (Aura) to display Student Profile photos. Behind the scene, it is using Salesforce Files (with the description Profile Picture).
How do you data load them? Here is the solution from Salesforce. A few tips you should be aware of:
- Batch size. Salesforce data loader has a limit of ~50MB per batch. We suggest you to take the biggest profile picture file size and calculate the Batch Size.
For example, my biggest profile picture is 200KB (0.2MB). Using the formula of 50MB / 0.2MB = 250, that means we can use the max Batch Size of 200. If your biggest profile picture is 400KB (0.4MB), you should use a Batch Size that is smaller than 125.
- Switch off any TDTM for ContentVersion and ContentDocument to speed up the load.
- Please make sure that you link this Document to a Contact.
For a Person Account, please select Account object when retrieving the profile picture. See also: RIO Ed - Attendance - Session List (Aura).
By default, this Profile Picture is only visible to internal Salesforce Users who have access to this record. If you want to open up to all external users, you must update the ContentDocumentLink.Visibility = AllUsers.
Deleting the Content can be tricky. While Salesforce allows you to create directly using ContentVersion, it doesn't allow you to delete ContentVersion. The only way to do it is to delete the ContentDocument.
If you want to WIPE ALL PROFILE PICTURES, you can query for all ContentDocument using this query: SELECT Id FROM ContentDocument WHERE Description='Profile Picture'.
Important fields to map while inserting ContentVersion:
Field to Map | Remark |
ContentVersion.Description | Hardcode it to "Profile Picture". |
ContentVersion.VersionData | Full path. For example: C:\images\student_12345.jpg |
ContentVersion.Title | Use a meaningful name. It doesn't matter what name. |
ContentVersion.FirstPublishLocationId | ContactId (starts with 003). |
ContentVersion.PathOnClient | Use the same full path as VersionData. |