Live-Profile and User photo integration?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2019 11:39 AM
Hi All - I'm trying to have a user's photo in the sys_user table update their photo in the live_profile table.
1) Is this not OOB? (I.e, do I need to write a biz rule for it?)
2) (potential) biz rule:
when sys_user photo updated;
get image and
insert it in associated live_profile field.
Anyone have any tips from doing this before? Any cautions?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2019 11:54 AM
I think your plan of action for updating the photo is the best course of action.
One reason for the live_profile being a "duplicate" is that some users (like us) use Connect Support chat. The Connect Support chat session relies on the information within the live_profile table and allows us to give our users a "public facing" profile with a custom name (so their last name is not shown) and a company logo for their avatar (so their personal picture is not shown).
Your business rule sounds like a perfect way to achieve this if you always want them sync'ed. I would just question whether you do need to sync them or not. At least in Connect Support if I leave their photo blank in live_profile it uses the one from the sys_user table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2019 11:55 AM
Hi,
There does not exists OOB.
You can try using below business rule on User (sys_user) tablethat runs after insert/update with condition as
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var livetable=new GlideRecord('live_profile');
livetable.addQuery('document',current.sys_id);
livetable.query();
while(livetable.next())
{
livetable.photo=current.photo;
livetable.update();
}
})(current, previous);
Would not have any negative impact as the source of image would most possibly be AD always & thus avoid having different photos for same User.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 05:16 AM
I'm trying to do the reverse of this and did this script. It worked once, but that was it.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr=new GlideRecord('sys_user');
gr.addNullQuery('photo');
gr.addQuery('sys_id', current.getValue('document'));
gr.query();
while(gr.next())
{
gr.setValue('photo', current.getValue('photo'));
//gr.photo=current.photo();
gr.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 06:24 AM
If you need the reverse, use this one.
https://community.servicenow.com/community?id=community_question&sys_id=105ec685dbca41d0e2adc223059619ca