- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â02-21-2022 10:25 PM
I want to upload data in contract table and the records contain attachment also. Can any body help how to upload the attachment data.I am getting the data through excel sheet.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-03-2022 01:39 AM
Then check this blog where I have recently shared the approach
is it possible to send attachment through transform map?
Tell customer to send all these details in the excel file
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
Like this
OnAfter script would be like this
(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 ecc = new GlideRecord('ecc_queue');
ecc.initialize();
ecc.agent = "AttachmentCreator";
ecc.topic = "AttachmentCreator";
ecc.name = fileName + ":" + fileContentType;
ecc.source = target.sys_class_name + ":" + target.sys_id;
ecc.payload = fileData;
ecc.insert();
})(source, map, log, target);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-02-2022 11:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-02-2022 11:25 PM
Hi,
So what does the excel contain?
Does it contain the file name, content type, data of file?
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-03-2022 01:20 AM
right now all this info I can ask from the client..I currently have a scenario if I want to upload attachment and attach to a particular record of contract, then how can i do it??
Importing is done from excel..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-03-2022 01:39 AM
Then check this blog where I have recently shared the approach
is it possible to send attachment through transform map?
Tell customer to send all these details in the excel file
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
Like this
OnAfter script would be like this
(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 ecc = new GlideRecord('ecc_queue');
ecc.initialize();
ecc.agent = "AttachmentCreator";
ecc.topic = "AttachmentCreator";
ecc.name = fileName + ":" + fileContentType;
ecc.source = target.sys_class_name + ":" + target.sys_id;
ecc.payload = fileData;
ecc.insert();
})(source, map, log, target);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader