- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2022 02:56 AM
Hi All
My requirement is business will be encoding the attachment and sending that encoded value in excel format and the same we need to decode and transfer to ritm form via transform map.
So is it possible to do so? if yes how?. what transform script we need to use to achieve this functionality
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 06:34 AM
Hi,
So you can use this in global scope
(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);
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-07-2022 04:02 AM
Ending with 06 decoded correctly but for 74 noting attached in RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 04:11 AM
Hi,
if it worked for 1 row then it should work for other as well
try to debug for that RITM in sys_attachment any file is present or not
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-07-2022 04:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 11:29 PM
Hi ankur
I used your code in transform script.
But After opening the attachment, I am not seeing the data in any pdf,word,excel file and I am seeing the data in text files.
After downloading the pdf file, I am seeing the empty content
Original file
Can you give me the solution for this, please.
Thanks
Regards
Raju Manga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 11:46 PM
it has worked for other member earlier.
are you sure you are sending correct base64 data?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader