- 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
02-08-2022 09:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 02:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 12:04 AM
attached attachment.
While opening attachment /still in encoded format.
Data which we uploaded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 01:06 AM
do this
use writeBase64() method instead of write()
(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.writeBase64(target, fileName, fileContentType, fileData);
})(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-02-2022 02:24 AM