DocuSign Connect - purchase-order-failure tutorial
Advanced Tutorial Using purchase-order-failure Template
If you'd like to try a more advanced template, add the purchase-order-failure Smart Clause® Template to your contract on Clause. This Smart Clause® Template will determine if a purchase order is received past the due date and issue a payment obligation for a penalty if late. The Smart Clause Template is stateful and will keep track of the total number of late purchase orders. When the number reaches the integer set as maxFailures, an additional charge will be added to the penalty.
Firstly ensure you have configured the DocuSign listener as described here.
You can configure your Smart Clause® Template to send an email with the amount owed or even trigger a Stripe payment to be made. View the flows documentation for more info.
The next step is to sign your Smart Legal Contract in Clause and create an HTTP Trigger.
Once you have signed a contract running on Clause with the purchase-order-failure Smart Clause® Template, you can issue purchase order agreements from your DocuSign account. Each DocuSign envelope should include the following custom envelope fields: connectTriggerUrl, connectBearerToken. You can create a template that pre-populates the connectTriggerUrl and connectBearerToken with those from the Smart Clause. When the agreement is signed (signaling receipt of the order), the Smart Clause will be triggered and will check the time of receipt against the delivery date and emit a payment obligation if late.
Creating a Purchase Order Template
- The first stage to creating a template in DocuSign is to create a Word document that will be used to overlay the DocuSign fields that the recipient will enter data into. The Word document does not have to conform to a specific layout for format, so here is an example used this tutorial:
- In DocuSign, go to the Templates tab and click Create A Template.
- Upload the Word document you just created.
- Add a recipient and ensure that they are marked as needing to sign, and click Next.
- Under the Custom Fields tab, create the following fields, ensuring that they have the exact names and configuration as specified below:
actualPrice: Text type with Numbers validation enabled
deliveryDate: Text type with Date validation enabled
currencyCode: Text type with no validation
For example, the actualPrice field will be configured as follows:
Next drag each custom field onto the document where you want the input field to appear.
Add a signature field to the document from the Standard Fields palette.
Click the Next button, then give the template a name and save.
Creating and Signing a Purchase Order
- In the templates view, select the Use option under the template that has just been created.
- Add a recipient who will be asked to enter the purchase order details and sign the document, and click Send.
- An email will be sent, inviting the recipient to review and sign the document. Click on Review Document.
- Fill in the details on the document and sign it. If you enter a date in the past, this will trigger a penalty payment that will result in an email being generated by the Clause action setup earlier. Then click Finish.
- At this point the Clause will be trigger by DocuSign and a request will be sent with the default envelope data as well as the data entered by the recipient. This should result in an email being generated by the Clause action setup earlier, detailing the penalty amount calculated by your Smart Clause.