Inserting a picture to an Image field through Script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 07:50 AM
I want to insert an image from a script into the table. Basically, I'm receiving an image in the base64 format through a rest API call in my script and now I want to insert the same into the table having a column image of type image.
Labels:
- Labels:
-
Scoped App Development
- 6,007 Views
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2024 06:44 AM
You can chekc and modify the below code as per your requirement
var content =current.variables.base64value; //base64value is my Multi line text variable name
//gs.addInfoMessage(content);
var fileName = 'u_sign_image:submitter-sign.png'; //u_sign_image is a image type field name
var contentType = 'image/png';
var tableName = 'sn_hr_core_case_total_rewards';
var tableSysId = current.sys_id;
var eccGr = new GlideRecord('ecc_queue');
eccGr.initialize();
eccGr.setValue('agent', 'AttachmentCreator');
eccGr.setValue('topic', 'AttachmentCreator');
eccGr.setValue('name', fileName + ':' + contentType);
eccGr.setValue('source', tableName + ':' + tableSysId);
eccGr.setValue('payload', content);
var sys_id = eccGr.insert();
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2024 06:49 AM - edited ‎09-04-2024 05:24 AM
Check the above comment, editing this as I commented the same thing twice.