- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 08:56 AM - edited 11-01-2022 09:07 AM
Hello,
I am trying to add attachment using Base64 but the output is not expected. its showing corrupted image. what could be the issue ?
Actual Image
Output
var data = 'AwAUADC39lhI/wBWMUfZIP8AnkKsUUAV/skH/PIUfZIP+eIqLU3ARFyck54p2nhhEwYEEN3PtTAk+zRf88xTTaQ84jwfUVZoPSkAUUlFADJY0kA3qDj1pYkWNcKMClbpQvSgB1Hako7UAf/Z';
var attachment = new GlideSysAttachment();
var rec = new GlideRecord('incident');
var incidentSysID = '4a05c6bedb72d510cb58b7e8f49619a9';
rec.get(incidentSysID);
var fileName = 'example.png';
var contentType = 'image/png';
//var base64Encodedcontent = 'SSBhbSB0ZXh0Lg==';
var agr = attachment.writeBase64(rec, fileName, contentType, data);
gs.info('The attachment sys_id is: ' + agr);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 09:34 AM
That fails in the Global application scope. It worked for me when I ran that in Scripts Background in application scope I have there. See:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 09:34 AM
That fails in the Global application scope. It worked for me when I ran that in Scripts Background in application scope I have there. See:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 01:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2024 09:30 AM
did you find an issue? I'm generating image, but it's corrupted also
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 07:49 AM
I am facing similar issue.
Any workaround?
Is this issue fixed?