pegros / PEG_LIST

Set of configurable/actionable LWC list components for Salesforce Lightning UX
MIT License
20 stars 9 forks source link

[feat] sfpegProfileCmp - Support wider range of banner and avatar images #46

Closed eloscarfr closed 1 year ago

eloscarfr commented 1 year ago

Is your feature request related to a problem? Please describe. Avatars (and banners) pictures are given by a Static Ressource. Even if it provides a flexibility (name of the image within the Static Ressource can be given by a custom field), it would be super useful, if a "File" can be used instead, so it could be completely dynamic (name). My requirement is to display the picture (name give by a custom field) of a user (custom object), without the constraint of the maximum size of static ressources (5M), and the need to update the Static Ressource image zip file, each time a new user is created (and a new avatar is needed).

Describe the solution you'd like Ideally, the url to the Avatar could be given by a field of the record (formula field), linking to a File / asset. By the way, this could allow to mutualise images used on CRM-A dashboards.

Describe alternatives you've considered Having the name of the static ressource given by a custom field (instead of SfpegAvatars fixed values), which will allow to get rip of the max size limitation (use of more than 1 Static ressource).

Additional context n/a

pegros commented 1 year ago

Implemented in build 242de70

The solution relies on an additional fileFieldName property for avatar and banner definitions, providing the API Name of a field containing the Salesforce ID of a content document to be used. It comes in addition to the previous static resource based mechanism, which may still be used as a fallback option if the fileFieldName value is null.

The sfpegFileManagerCmp component in the PEG_MISC repository may be leveraged to upload related files and automatically register their IDs on the records.

FYI @eloscarfr

pegros commented 1 year ago

@eloscarfr Following our recent discussions, just added a new native option to handle standard Salesforce asset files, enabling to reference those files by their names.

eloscarfr commented 1 year ago

Thanks @pegros it works perfectly! 👍