The CreatorCon Call for Content is officially open! Get started here.

How to Sync sys_user image to Live_profile image

krishnakumar2
Tera Guru

HI Team,

I have a requirement to sync photo from Custom User Profile table to sys_user table and live_profile table. I tried scripting it but it's not working. I am just not able to update the image in live_profile using script. It's working perfectly fine for user table but not getting inserted in live_profile table.

Here is the before business rule script I have added.

var image_sysid = current.u_photo;
var user_sysid = current.u_parent.u_user;

 

//update user table image
var usr = new GlideRecord('sys_user');
usr.addQuery('sys_id',user_sysid);
usr.query();
while(usr.next()){
usr.photo = image_sysid;
usr.update();
}

// update live profile pic
var liveprofile = new GlideRecord('live_profile');
liveprofile.addQuery('document',user_sysid);
liveprofile.query();
while(usr.next()){
liveprofile.photo = image_sysid;
liveprofile.update();
}

 

I am going clueless about how to fix this. Any inputs/guidance you give will be of great help.

9 REPLIES 9

hi Krishna,

 

I too have the same requirement, did you get any solution for this?if so please can you share the code.

krishnakumar2
Tera Guru

no luck yet 😞

Rodrigo Renie
Tera Expert

Has there been any advances on this? I've just posted a very similar question and I've managed to update other fields from live_profile like the short_description, but not the photo.

No luck. I have stopped looking for the solution 😞

jjones4773
Tera Guru

This URL has the correct script.

 

https://community.servicenow.com/community?id=community_question&sys_id=3df01381db4e7bc0d58ea345ca961918