Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to get the Avatar of the user table and make a list of user portraits in the portal (simple list)

lzj
Tera Contributor

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}} />

 

find_real_file.pngfind_real_file.png

5 REPLIES 5

Vasantharajan N
Tera Sage
Tera Sage

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

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.

 

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

Shruti
Mega Sage
Mega Sage

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>