- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2025 04:31 AM
Hi all,
I want to write a scripted api to upload the photo to user table. Here is my code but failed. Please help to correct the code.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2025 07:53 AM
try this link where I shared solution to attach file via scripted rest api then enhance it based on your requirement. once the image is copied to record, simply query sys_attachment with this user sysId and update the table name as 'ZZ_YYsys_user'
Scripted Rest API to update incident with attachment
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2025 07:06 AM
It is base64encoded data and running in global. I try to use
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2025 07:15 AM
I also try this code in backgound and got the same issue. Sorry, It not allowed to post the Binary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2025 07:29 AM
since you in global scope write() method only accepts the actual content and it will work for text, csv files which are plain files.
try this link where I shared solution to attach file via scripted rest api then enhance it based on your requirement. once the image is copied to record, simply query sys_attachment with this user sysId and update the table name as 'ZZ_YYsys_user'
Scripted Rest API to update incident with attachment
Also share your JSON request body, how it looks
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2025 07:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2025 07:53 AM
try this link where I shared solution to attach file via scripted rest api then enhance it based on your requirement. once the image is copied to record, simply query sys_attachment with this user sysId and update the table name as 'ZZ_YYsys_user'
Scripted Rest API to update incident with attachment
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
