How to Attach a Profile Photo to a Newly Created User Using Script?

VENKATASAMPATH
Tera Contributor

Hi Team,

I am looking for a script-based approach to attach a profile photo to a newly created user (sys_user).

My instance does not have a user_image table. I would like to know how to associate a profile photo with a user record using a script.

Requirements:

  • Create a new user record in sys_user using a script.

  • Attach or associate a profile photo with the user through the same script.

  • If the photo is stored as an attachment, how can it be copied from an existing record to the newly created user using a script?

  • Is there a supported API or recommended method to set the User Photo field through scripting?

Could someone provide a sample script or guidance on the recommended approach?

Thank you.

5 REPLIES 5

Tanushree Maiti
Tera Patron

Hi @VENKATASAMPATH 

 

Check this post for the script :

https://www.servicenow.com/community/developer-forum/uploading-profile-avatar-images-via-rest-api-ge...

 

https://www.servicenow.com/community/developer-forum/upload-profile-photo-in-user-table/m-p/1943887/...

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti