When you're loading dynamic information to populate a Contract, it can be frustrating when the information isn't loading properly! Here are some things that may be going wrong if your Tokens aren't loading inside of your Contracts.

1. Not setting "dynamic" to "true" in your code

When trying to pass in dynamic variables, you need to tell the PactSafe library that you're dynamically loading the Contract. This parameter will instruct PactSafe to ingest "render data" that you pass and inject it into the Contract where necessary.

  (function(w,d,s,c,n,a,b){w['PactSafeObject']=n;w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)}, w[n].on=function(){(w[n].e=w[n].e||[]).push(arguments)},w[n].once=function(){(w[n].eo=w[n].eo||[]).push(arguments)},w[n].off=function(){(w[n].o=w[n].o||[]).push(arguments)},w[n].t=1*new Date(); a=d.createElement(s),b=d.getElementsByTagName(s)[0];a.async=1;a.src=c;b.parentNode.insertBefore(a,b) })(window,document,'script','//vault.pactsafe.io/ps.min.js','_ps');
  // note dynamic being set to true!
  _ps('create', '25b2b173-632a-4227-9877-31d2109d8c98', { dynamic: true });

2. Not passing in render_data to populate Tokens

In order for dynamic information to render in your Contracts, you must pass the right dynamic values based on what Tokens are included in the JavaScript object you're loading into the page. Here's an example demonstrating how you pass render data into your Contract:

var what_to_render = {
    price: "$6,000",
    total: "$6,000",
    start_date: "July 1, 2016",
    payment_terms: "Net 30",
    users: 2,
    specific_terms: "We can use your company name and logo as we see fit.",
    in_california: true,
    additional_terms: [
        term: "Term 1!"
        term: "Term 2!"
        term: "Term specific to Anil"
  var agreement_key = 'dynamic-contract';
  _ps('load', agreement_key, { render_data: what_to_render });

You'll notice "additional_terms" is passed in as an object. PactSafe does support looping in a Contract via Handlebars... just paste this into a Contract to see it in action:

Contract example text...
#{{#each additional_terms}}

3. There are spaces in your Token names

Our editor shouldn't let you add spaces to your Token names, but spaces make it in there from time to time! If you have a space in your token name (like #{{First Name}}), that will prevent all dynamic functionality from working on your web page.

None of these issues the one that's causing you heartache? Start up a chat with us and we'll have a look!

Did this answer your question?