Unable to add an signature as an attachment to Signature Image table .....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2017 06:10 AM
I have not used any OOTB Script to create an signed image as an attachment on Signature Image table.
I have created a UI Page to accept the name and Signature .(Signature is drawn on Signature Pad i.e in html Canvas),
wrote a script include to insert an record and add an attachment on Signature Image table with all data.
The Signature drawn was converted to base64 format ,and tryed created a record on ecc queue table with base64 payload for the record inserted on Signature Image table.
the Issue i m Facing is, record is been created on ecc queue but attachment is not created can anyone help.....
below is the code i have written....
Script :-
insertSignature: function() {
var sig = this.getParameter('sysparm_sig'); //signature
var sigName = this.getParameter('sysparm_sigName'); //receiver name
var table = this.getParameter('sysparm_table'); //table name
var sysid = this.getParameter('sysparm_sysid'); //record id
var user = this.getParameter('sysparm_user');
var aTag = this.getParameter('sysparm_aTag');
var arr=sig.split('base64,');
var sigRec = new GlideRecord('signature_image');
// sigRec.signed_name = sig;
// sigRec.u_signature = sig;
sigRec.u_receiver_name = sigName;
sigRec.signed_on=gs.now();
sigRec.user= gs.getUserID();
sigRec.table = table;
sigRec.document = sysid;
sigRec.is_drawing=true;
var id=sigRec.insert();
}
**********************************************************************************************************************************************
below is the ecc queue record created....
I am Getting the Message Attachment Creation Failed ....
This is working fine on dev instance but not on client ...........
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2017 06:14 AM
Code to insert on ecc queue
var attCreator = new GlideRecord('ecc_queue');
attCreator.agent = "AttachmentCreator";
attCreator.topic = "AttachmentCreator";
attCreator.name = id+":image/png";
attCreator.source = "signature_image:"+id;
attCreator.payload = arr[1].toString();
attCreator.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 09:53 PM
Try using the below code instead of ecc queue
//add Attachment
var StringUtil = GlideStringUtil;
var value = StringUtil.base64DecodeAsBytes(arr[1].toString());
var attach=new Attachment();
attach.write("signature_image",id,id+'.png',"image/png", value);
//attach.write(tablename,rec sysid,filename,content type,value) ;