Need to upload 168 different attachments - 1 each to 168 different records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Team,
I need to upload 168 attachments, 1 each across 168 different records. Can you please help with how I can upload all of these in bulk.
Please note that there's no attachment field in the records, so all would go to sys attachment table itself.
Could you please help with how I can upload them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
not possible directly to do this in bulk
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
How is this possible? Where will the system store the attachment if there is no attachment field?
We need an attachment field to store the files. If you upload an attachment for one record, how will it be associated with all 168 different records? Will the same file be copied to all 168 records, or what is the expected behavior?
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
Hi Atul,
What I meant to say is that there's no custom attachment field in the records. The records have the OOB manage attachments icon at the top.
There are 168 records, and for each record, a different attachment needs to be attached - which signifies 168 different attachments, and each would need to go into different individual record. Could you please help with how I can upload these in bulk?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Have a look: Try transform map
You should be knowing these details in order to work
1) the base64encoded data of the attachment
2) file name
3) content type
once you are sure these all data is present in excel you can use onAfter transform script so that it adds attachment to that record which got created/updated
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var fileName = source.u_file_name;
var fileContentType = source.u_content_type; // such as image/jpeg or application/pdf
var fileData = source.u_base64_data;
var sa = new GlideSysAttachment();
sa.write(target, fileName, fileContentType, fileData);
})(source, map, log, target);
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************