Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Can't delete profile picture

yundlu316
Kilo Guru

I'm trying to get a better sense of how the Profile picture works in Service Portal and uploaded a random profile picture, which shows up great:

find_real_file.png

My issue is when I delete the profile pic from sys_attachment (both the entry that starts with "thumb..." and the ZZ_YYlive_profile), clear my browser cache, and refresh my page, the profile page looks like this:

find_real_file.png

At first I didn't notice anything wrong with the above screenshot, but after impersonating another user, I noticed that the font awesome user icon is missing from the large avatar, and my initials are missing from the smaller avatar in the header: 

find_real_file.png

When I look inside the console for my profile, I notice that for the large avatar, there's still a sys_id associated with my profile picture even though I've deleted it completely from the sys_attachment table:

find_real_file.png

Am I missing a step in this?  If a user uploads a picture but then deletes it, how can they get rid of the sys_id that looks to still be rending a "blank" photo?

 

 

1 ACCEPTED SOLUTION

yundlu316
Kilo Guru

Hey Everyone,

I opened a HI Ticket and the technician helped me solve the issue.  This issue was completely my fault; should not delete profile pictures directly from the sys_attachment table for anyone who's facing the same problem.  Here is the solution that fixed it:

 

The below KB article documents how to delete/update user profile pictures:
https://hi.service-now.com/kb_view.do?sysparm_article=KB0687598

The delete should be performed from the live_profile table.

Still using the steps above I was not able to empty the photo field for the corrupt record and I had to run 2 clean up scripts:

Clear photo value in live profile:

var gr = new GlideRecord('live_profile');
gr.addQuery('sys_id', '0280fc77dba4d700af88f5861d961971');
gr.query();
while(gr.next())
{
gs.print("Updating user"+ gr.name);
gs.print("Actual Photo"+ gr.photo);
gr.photo = '';
gr.setWorkflow(false);
gr.update();
}


Clear photo value in sys_user:

var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', '62826bf03710200044e0bfc8bcbe5df1');
gr.query();
while(gr.next())
{
gs.print("Updating user"+ gr.name);
gs.print("Actual Photo"+ gr.photo);
gr.photo = '';
gr.setWorkflow(false);
gr.update();
}


After clearing the cache using cache.do everything was back to order.

View solution in original post

8 REPLIES 8

What can you (as that avatar should be stored in sys_attachment as well) is the following:

 

 

 

- using Chrome browser right click on the avatar and then Inspect

 

- in the inspector you should see something like below:

 

 

 

Screen Shot 2017-03-31 at 3.48.42 PM.png

 

 

 

- the sys_id you see there in red is the sys_id to the corresponding record in sys_attachment. Go to sys_attachment.list and in the filter use sys_id is <that sys_id>. This way you should get a record back. Let me know if this shows a record for you.

 

Regards,

Sachin

Thanks Sachin, but I've tried that as well:

<div class="sub-avatar mia" ng-style="avatarPicture" style="background-image: url("a110cbb0db823f00d8261b774896193d.iix"); color: transparent;">
<i class="fa fa-user"></i>
</div>

 

find_real_file.png

Soumita3
Tera Expert

Hi,

 

I would like you to check whether that particular image is deleted from the table where it is stored.

Could you please check the same and reload the page?

I hope your issue will be resolved.

 

Please mark the answer as correct if it suffice your query.

 

Thanks.
Soumita.

yundlu316
Kilo Guru

Hey Everyone,

I opened a HI Ticket and the technician helped me solve the issue.  This issue was completely my fault; should not delete profile pictures directly from the sys_attachment table for anyone who's facing the same problem.  Here is the solution that fixed it:

 

The below KB article documents how to delete/update user profile pictures:
https://hi.service-now.com/kb_view.do?sysparm_article=KB0687598

The delete should be performed from the live_profile table.

Still using the steps above I was not able to empty the photo field for the corrupt record and I had to run 2 clean up scripts:

Clear photo value in live profile:

var gr = new GlideRecord('live_profile');
gr.addQuery('sys_id', '0280fc77dba4d700af88f5861d961971');
gr.query();
while(gr.next())
{
gs.print("Updating user"+ gr.name);
gs.print("Actual Photo"+ gr.photo);
gr.photo = '';
gr.setWorkflow(false);
gr.update();
}


Clear photo value in sys_user:

var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', '62826bf03710200044e0bfc8bcbe5df1');
gr.query();
while(gr.next())
{
gs.print("Updating user"+ gr.name);
gs.print("Actual Photo"+ gr.photo);
gr.photo = '';
gr.setWorkflow(false);
gr.update();
}


After clearing the cache using cache.do everything was back to order.