AD Thumbnail Photos not importing using LDAP Import
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 03:20 PM - edited 05-02-2023 03:22 PM
I am using this article to attempt to import thumbnails from Active Directory (LDAP): https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0597756
However when the script runs, it is skipping this section below. I used logging to identify that the script is identifying that the thumbnail doesn't exist, and also checked that the thumbnail exists in the import set table. Our thumbnails are pretty small, but I still increased the table column to the recommended 13,500. I've tried to add the mid server properties directly to the properties file on the mid server and have restarted the mid several times.
if (newAttachment.next()) { newAttachment.table_name = "ZZ_YYsys_user"; newAttachment.table_sys_id = target.sys_id; newAttachment.content_type = 'image/jpeg'; newAttachment.update(); }
Has anyone used this article successfully in Tokyo?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 08:08 PM
Hi @Elizabeth Hemon ,
Please check the Support KB : https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0597756
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2023 09:27 AM
I was able to fix the issue by replacing the function and adding set user photo:
function attachPhoto(){
var DecodedBytes = GlideStringUtil.base64DecodeAsBytes(source.u_thumbnailphoto);
var attID = new GlideSysAttachment().write(target, 'photo.jpeg', 'image/jpeg', DecodedBytes);
var newAttachment = new GlideRecord("sys_attachment");
newAttachment.addQuery("sys_id", attID);
newAttachment.query();
if (newAttachment.next()) {
newAttachment.table_name = "ZZ_YYsys_user";
newAttachment.table_sys_id = target.sys_id;
newAttachment.content_type = 'image/jpeg';
newAttachment.update();
}
// Set photo for user
target.photo = attID;
target.update();
Found in the responses from @warren_chan here: