Update multiple users photo with an image
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 03:46 AM
Hello Devs,
Currently I'm trying to set an image for users who don't have any picture via script either background either a schedule job. After looking in many post I've notice that from the Employee Center->Profile-> Upload Picture will upload the picture in the Portal as well in the Back-End. After looking through the widget I saw that the picture is uploading to Live Profile table (live_profile) and then to User table (sys_user).
What I've tried to do was in the background script (for testing I was doing only for 1 user) was:
var image = new GlideRecord('db_image');
image.get('185a4fb2db019590e082ef0bd39619a3'); //-> get the image from the image table
var user = new GlideRecord('sys_user');
user.get('439c505d1bd9bd10822020aeab4bcb7c');
user.photo = image.image; -> set the image to user profile in back-end
user.update()
user.setWorkflow(false)
var live = new GlideRecord('live_profile');
live.get('de2604671b91bd10822020aeab4bcb38');
live.photo = image.image;-> set the image to user profile to be visible on portal
live.update()
live.setWorkflow(false)
Even though I'm setting the picture in both tables, I'm not able to see it on the Portal, back-end or when I try to mentioned someone in comments.
Did anyone experience this ?
Thank you!