How to get the Avatar of the user table and make a list of user portraits in the portal (simple list)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2022 08:15 PM
Hello!
I want to use the simple list in the portal to make a user list, and the avatar in the user table is used as the display field.
I wrote this in simple list, but the screen didn't show it.
<img alt="" src={{item.display_field.display_value}} />
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2022 08:56 PM
Take sys_id of live_profile table and search it in sys_attachment table to get the actual file and use style
style="background-image: url("<sys of sys_attachment table>.iix");
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2022 11:35 PM
Thank you for your answer, but the corresponding sys_user table image is not found in table sys_attachment.
How can I get the name of the picture in the avatar field of the user table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2022 11:51 PM
live_profile table has reference field to sys_user table. So please use dot walking to get the name from sys_user table.
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 12:52 AM
Hi, You can use below function in server script
Server script
var record = {};
data.list1 = [];
var avatarRec = GlideAvatarFinder.getAvatarPath('sys_id of user'); // pass sys_id of user
record.avatarPath = (avatarRec != null && avatarRec) ? encodeURI(avatarRec.toString().replace("?t=small", "")) : '';
data.list1.push(record);
HTML
<div ng-repeat="item in c.data.list1">
<div ng-if="item.avatarPath!=''">
<img src={{::item.avatarPath}} style="border: 1px solid #ddd;border-radius: 90%;padding: 5px;width:40px;height:40px;">
</div>
</div>