Where i can find sn-avatar documentation?

Gilmar Adrian
Tera Contributor

Hello, Friends!

 

I want to know how I can find the documentation about the "sn-avatar", the example code is:

<sn-avatar class="avatar-medium" primary="user.user_id"></sn-avatar>

I want to implement a user's list with your picture/avatar in the Service Portal, but just appears their initials and I really want to know how the <sn-avatar> works.

 

HTML Template:

<thead>
  <tr>
    <th>Photo</th>
    <th>No.</th>
    <th>Name</th>
    <th>User ID</th>
  </tr>
</thead>
<tbody>
  <tr ng-repeat="user in data.users">
    <td>
      <sn-avatar class="avatar-medium" primary="user.user_id"></sn-avatar>
    </td>
    <td>{{user.no}}</td>
    <td>{{user.name}}</td>
    <td>{{user.user_id}}</td>
  </tr>
</tbody>

 

Server Script:

(function () {
  var user_rec = new GlideRecord("sys_user");

  user_rec.setLimit(10);

  user_rec.query();

  data.users = [];
  var count = 1;

  while (user_rec.next()) {
    var user = {};
    user.no = count++;
    user.name = user_rec.getDisplayValue("name");
    user.user_id = user_rec.getValue("user_name");
    data.users.push(user);
  }
})();

 

Preview:

GilmarAdrian_0-1718659504033.png

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi,

 

Link to avatar documentation - https://developer.servicenow.com/dev.do#!/reference/next-experience/washingtondc/now-components/now-...

 

If this helps please mark as helpful.

 

Thanks,

Sravani

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Hi,

 

Link to avatar documentation - https://developer.servicenow.com/dev.do#!/reference/next-experience/washingtondc/now-components/now-...

 

If this helps please mark as helpful.

 

Thanks,

Sravani

I don't understand why the attributes are different from each other.

GilmarAdrian_0-1718715849222.png

But seriously, thanks for the information. I sorted it out and found these links yesterday. There was a problem with the "image-src" attribute.