How to Add Digital Signature in Salesforce Documents?

blog-image

In today’s fast-paced business environment, efficient document management is essential. Salesforce offers a robust platform for document storage and management, but to truly optimize processes, digital signatures are indispensable. By integrating digital signatures into Salesforce, organizations can streamline approvals, enhance security, and reduce operational costs.

This blog post explores how to seamlessly add digital signatures in Salesforce documents using the KAiZEN tool.

Using KAiZEN, businesses can easily add digital signature in salesforce documents (i.e; contract, deal or any confidential doc) in a most secured way. There is no need for the sales team to send any physical documents for signing, as it will take time and can delay the process.

Signers can create/draw/upload a secure and verifiable signature, which can be used on any device to digitally sign or embed sign to a specific location on the documents.

Salesforce Admins / Developers can easily integrate KAiZEN API’s to enhance the e-signing capabilities for the company. Additionally, sales team can track the status of the signed documents and can send the documents to multiple signers in the hierarchy model.

KAiZEN API’s can be easily integrated into Apex, Aura Components, or LWC and offers wide range of API to manage different actions.

Few simple steps to add digital signatures in salesforce documents:

  1. Step 1:

    Identify a File or attachment or PDF (visualforce page render As PDF) which needs to be digitally signed by single or multiple users. Once it is identified, then use below line of code to convert the blob into base64.

    String FileData = EncodingUtil.base64Encode(<< blob Content >>);

    Various ways to get blob content:

    1. If using visual-force page for pdf creation, then use below lines of code:PageReference pageRef = new PageReference(‘/apex/ServiceReportPDF’);Blob pdfBlob = pageRef.getContent();String pdfBase64 = EncodingUtil.base64Encode(pdfBlob);
    2. If using existing File or attachment, then query the File / AttachmentAttachment att = [Select Id, Body from Attachment limit 1]; // or add some filtersString pdfBase64 = EncodingUtil.base64Encode(att.body);
  2. Step 2:

    Identify the users which needs to sign the document along with their levels or order hierarchy. Order means the sequence in which the signers will sign the document. Person with Order 2 will sign only after person with order 1 has signed.

    Let’s define the below two users which the order of signing.

    Signer Information
    Signer Name Order Signer Email
    Mr Harjeet 1 testmail@gmail.com
    Mr Gurleen 2 sales@ayansoftwares.com
  3. Step 3:

    Need to make a secure HTTP Callout to call the KAiZEN “Initiate Sign API” request as per the below details:

    HTTP Request Parameters
    Paramters Name Value
    Content-Type application/json
    Method POST
    Endpoint https://fa-kaizen-prod.azurewebsites.net/api/Sign/RequestStr?code=RTa1A0GW5Yl92OF54-73lRqglLFCt_0pVcg86hWf1EjtAzFuNROcdA==
    Body JSON Body with parameters
    Request Body Parameters
    Paramters Name Description Required?
    docContent Base64 Content for the PDF File Yes
    docName Name of the File Yes
    appToken Unique Code to initiate the request Yes
    requesterEmail Email address of the person initiating the request Yes
    requesterName Name of the person initiating the request Yes
    description Describes the document NO
    signers An array of the signers who needs to sign the document in the pre-defined order. Yes
    CallBackURL CallbackURL defines the url on which the KAiZEN should send a response once all the signers signs the document. It can be webservice url of Salesforce or any external page.
    Eg: https://duumy.my.salesforce- sites.com/services/apexrest/KaizenCallbackURL/
    No
    docDescription Describes the document No

    Sample HTTP Request:
    HttpRequest request = new HttpRequest();
    request.setEndpoint( << Initiate Sign Endpoint URL >> );
    request.setMethod(‘POST’);
    request.setHeader(‘Content-Type’, ‘application/json’);
    request.setBody( << JSON Body as shown below >> );
    request.setTimeout(120000);

    Sample JSON Body:
    {
    “docContent”: “<< Base64 Content for the PDF File. Refer Step 1>>”,
    “docName”: “TestBase64File”,
    “appToken”: “01HQMDX-YCP019-Z2P3SX-QPSB53-8B4A3F-BC40B8-B10908-FB2FF4-A”,
    “requesterEmail”: “mishu67777@gmail.com”,
    “requesterName”: “Mohit Bansal”,
    “description”: “Sales Contract Document”,
    “signers”:[
    {
    “signerEmail”: “testmail@gmail.com”,
    “signerName”: “Mr Harjeet”,
    “order”:”1″
    {
    “signerEmail”: “sales@ayansoftwares.com”,
    “signerName”: “Mr Gurleen”,
    “order”:”2″
    },

    ],
    “CallBackURL”: “<< callback url >>
    “docDescription”: “Sales Contract Document”
    }

    Sample HTTP Response:
    {
    “FailRules”: [],
    “Data”: {
    “SignRequestId”: “01HV6MEARQD3X8ZXXX5FR3YDB8”,
    “RequestNo”: “KAiZEN-118”
    }
    }

    Once the request is submitted, it will send a response with the request Id. If the callback url is configured, it will send a signed copy of the document on the defined url, once all the signers will sign the document.

  4. Step 4:

    Once the request is sent out to the signers, each signer will receive an email to sign the document in the order as defined in the request.

    Let’s see how the digital signing part works:

    1. Open the KAiZEN email request sent for e-signing.
      How to add Digital Signature to Salesforce Documents
    2. Click on the button “Click here to Sign” and it will open the document in the KAiZEN editor to sign.
      Screenshot 2024 04 12 at 11.41.12
    3. Requestor can define the location where signer needs to sign. It can defined in two ways:
      1. In the PDF, add a hidden text with keyword “KAIZEN1” or “KAIZEN2″ or KAIZEN3”, where KAiZEN is a hardcode keyword and number sequence is the order of the signer.
      2. Click on “+ Signature” button and it will open a popup where signer can draw or upload any signature
        Screenshot 2024 04 12 at 11.46.46
        Screenshot 2024 04 12 at 11.51.12
      3. Once signed, click on the submit button.
        Screenshot 2024 04 12 at 11.53.14
      4. In the same way, all the defined signers will sign the document. Once all the signers complete the signing, it will perform the below actions:
        • Send an individual email to all the signers with the signed document
        • Send the signed copy of the document on the callback url defined.

All the requests which are initiated or signed can be tracked inside the customer portal of KAiZEN.

Benefits of digital signing salesforce documents with AYAN KAiZEN:

  • User can easily integrate apis in Salesforce via apex, AURA or directly in FLOW.
  • Each sign request can send request to single or multiple users in the order of their hierarchy.
  • All the signatures has status of “verified signature” by AYAN Softwares’ digital approved certificate.
  • Secure and reliable platform.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top