How to copy photo from user table to live_profile table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 09:06 PM
I have created below script which is working fine and copying attachments from user table to live_profile table.
But the issue is it is not creating entry in sys_attachment table.
I have a requirement that when attachment is copy from user table to live_profile table it should create record in sys_attachment table.
Could someone help how could we achieve this.
var query = 'user_name=atutuor';
var profileUser = new GlideRecord('sys_user');
profileUser.addEncodedQuery(query);
profileUser.query();
while(profileUser.next()) {
var userUser = new GlideRecord('live_profile');
userUser.addQuery('document',profileUser.sys_id);
userUser.query();
if(userUser.next()){
userUser.setValue('photo',profileUser.photo);
userUser.update();
userUser.setWorkflow(false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 09:09 PM
Hi @Shivam32
please find the solution on page https://docs.servicenow.com/en-US/bundle/tokyo-servicenow-platform/page/script/useful-scripts/refere...
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 09:44 AM
Broken link here. Can you update, @Maik Skoddow ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @David Lundy ,
I believe this is the docs link that Maik provided above: https://www.servicenow.com/docs/csh?topicname=r_UsefulAttachmentScripts.html&version=latest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Try changing below:
userUser.setValue('photo',profileUser.getDisplayValue(“photo”));
Raghav
MVP 2023