How to use signature pad in service portal page?

Felix20
Mega Guru

Hallo everybody,

I'm working on a PoC and one requierement is to sign a table entry (request).

So user will have to fill a form and finally sign it using a signature pad. I saw there is a plugin: com.snc.signaturepad which activates a UI Page which contains a signature pad.

But how to use that UI Page as part of a widget in Service Portal?

Because our page will be face to customer, we dont want to our customer to be in backend so sign the filled form.

I searched long time and haven found a solution yet.

e-Signature is not a possibility, because we need it manually signed and username + password is not an option.

 

Best regards,

1 ACCEPTED SOLUTION

Ragini Kukade
Kilo Guru

Hi,

Hope the following link will help you:

https://sc.service-now.com/snds?state=widget-detail&sys_id=c292430f13a97a002ea1b2566144b0d4

Mark it as correct/helpful,if it helps.

Regards,

Ragini

View solution in original post

25 REPLIES 25

Hi Shreya,

 

First I loaded PE Signature Pad loaded from https://github.com/platform-experience/serviceportal-widget-library/blob/master/pe-emp-exp-signature...

  1. After committing the update set, we made the below changes:
    1. Stored the signature value in a hidden variable by converting that into base64. For this, we made changes to the Widget Client script. The updated client script is:

      function ScratchPadController($scope) {

          var c = this;

       

          c.showval = false;

          

          c.done = function() {

              var signature = c.accept();

              c.showval = true;

              if (signature.isEmpty) {

                  // console.log('scratch pad empty');

              } else {

                  // console.log(signature.dataUrl);

                  var str = signature.dataUrl;

                  var newInput = {

                      value: signature.dataUrl

                  }

                  var finalstr = str.replace(/^data:image\/(png|jpg);base64,/, "");

                  $scope.page.g_form.setValue('base64value', finalstr);

                  

                  //c.server.get(newInput);

              }

          }

       

          c.clearVal = function() {

              $scope.page.g_form.setValue('base64value', '');

              c.showval = false;

              var signature = c.clear();

          }

      }

    2. Another changes was to attach the converted signature to the target record. For that, we added ‘Post insert script’ on record producer, see below script to attach the sign as an attachment to Case(target record)

      var content =producer.base64value;  //base64value is my Multi line text variable name

      var fileName = 'submitter-sign.png';  //name given to attachment at target record

      var contentType = 'image/png';

      var tableName = 'sn_customerservice_case';

      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();

Hi Sachin,

Thankyou so much, but still only 2 buttons are visible.. signature pad is not visible

Shreya_0-1692701976889.png

 

Hi,

Can you please confirm if you committed the update set named "PE Emp Exp Signature Modal Header " from the link above. This update set contains all the required angular providers and scripts required for sign pad to appear. I tried in my PDI and this is what the update set looks like after committing.

SachinDahiya_0-1692838506537.png

And, after that, I created a test RP with a variable type 'Custom' and added the widget. This is what I can see.

SachinDahiya_1-1692838594623.png

 

If you are unable to see the scratchpad after following above steps then , can you post all the steps you followed to make this work and I cna review.

 

Thanks,

Sachin

Hi Sachin,

I am able to sign it now and attachment is also attaching to target record but that attachment is not supporting when downloaded.

I’ve successfully implemented the feature to attach the signature to the case and store it in an image-type field in the table. However, I’m encountering an issue when trying to add this image field to the document—the signature isn’t appearing in the generated document. Could you please share how you managed to get it added to the document?

Edit:

got the solution and I am able to use the generated image as signature for document now.