Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Signature Action Item not adding signature to SC_TASK item via Agent Mobile.

Daniel Klaas
Tera Contributor

Hi, 

 

I'm trying to add collect signature functionality to sc_tasks in Agent Mobile. I've created a function and added it the UI of Agent mobile named Signature (see images). When clicked a signature box opens up and allows end users to sign and submit the signature. 

 

What I want to happen is for the signature to be added to the sc_task record it was generated from. The signature does get collected and added to the signature_image table but nothing else happens. 

 

This is my execution script on the action item: 

 

 

 

(function WriteBackAction(parm_input, parm_variable, actionResult) {
    var gr = new GlideRecord("sc_task");
    gr.get(parm_variable['sys_id']);
    
    
      // in this example "signatureInput" is the name of a sys_sg_input of type signature
      // SignatureType will return either "Image" or "Text"
    var signatureType = parm_input['Signature']["SignatureType"];
      // SignatureValue will return a String containing the base64 respresentation of the image in the case of a drawn signature
      // or a String with the name of the user if they typed their name
    var signatureValue = parm_input['Signature']["SignatureValue"];
    var table = "sc_task";
    var documentId = parm_variable['sys_id'];
    var signatureHandler = new sn_mobile.MobileSignatureHandler();
    if (signatureType == "Image")
        signatureHandler.insertSignatureImage(table, documentId, signatureValue);
    else if (signatureType == "Text")
        signatureHandler.insertTypedSignature(table, documentId, signatureValue);

gr.update();
})(parm_input, parm_variable, actionResult);

 

 
What am I missing here? 
 
2 REPLIES 2

Abbas_5
Tera Sage
Tera Sage

Hello @Daniel Klaas,

Please refer to the below link's:
https://www.servicenow.com/community/now-platform-forum/e-signature-on-catalog-item-task-allow-sign-...

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0829875

 

Mark my correct and helpful, if it is helpful and please hit the thumbs-up button to mark it as the correct solution.
Thanks & Regards,
Abbas Shaik

Igor_Semedo
Tera Contributor

Hi Daniel,

The attachment with the signature image is created and stored in the signature images table [signature_image].
This table tracks the table of the record for which signature (sc_task in your case) is needed, the document id of the record, and the signature attachment.

Best regards,
Igor Semedo