zenbudda
zenbudda

Reputation: 11

How do you update Docusign Clickwrap render call to include a custom value for clientUserId

Here is Docusign's Clickwrap example.

var myCustomUserId = Math.floor(Math.random() * 100000) + 1;
console.log(myCustomUserId); // this works

<div id="ds-terms-of-service"></div>
<script src="https://demo.docusign.net/clickapi/sdk/latest/docusign-click.js"></script>
<script>docuSignClick.Clickwrap.render({
environment: 'https://demo.docusign.net',
accountId: 'daf5048a-xxxx-xxxx-xxxx-d5ae2a842017',
clickwrapId: '9888ca17-xxxx-xxxx-xxxx-9bd95f46345d',
clientUserId: myCustomUserId
}, '#ds-terms-of-service');

I am creating an overly simple html app that is attempting to send a custom userid to the Clickwrap service. However, the above example does not work (even using our actual accountId and clickwrapId). How do you update myCustomUserId in this clickwrap call with a variable inside my html (hopefully using simple javascript/css/html)?

I have a hunch the example code I posted above (copied from their website) was meant as a 1-off test and not a fully functioning example. I want to confirm my suspicion that we may have to call another api to request a clickwrap, and pass that api the clientUserId, and in return, docusign returns the full clickwrap with the embedded clientUserId value.

Thanks in advance!

Upvotes: 0

Views: 363

Answers (1)

Matthew Roknich
Matthew Roknich

Reputation: 908

<!DOCTYPE html>
<html>
  <head>
    <title>Test</title>
  </head>
  <body>
    <div id="ds-clickwrap"></div>
    <script src="https://demo.docusign.net/clickapi/sdk/latest/docusign-click.js"></script>
    <script>
      const myCustomUserId = Math.floor(Math.random() * 100000) + 1;
      docuSignClick.Clickwrap.render(
        {
          environment: "https://demo.docusign.net",
          accountId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          clickwrapId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          clientUserId: `${myCustomUserId}`
        },
        "#ds-clickwrap"
      );
    </script>
    <script src="index.js" async defer></script>
  </body>
</html>

Hey zenbudda! For testing purposes, This should do the trick. You need to pass in your custom ID properly.

Upvotes: 1

Related Questions