Create Multiple Documents

Data Routing is an easy way to create multiple (or different) documents from a single data feed. For example, you might want to create two documents from an order form – one as a receipt to your customer and another as a shipping slip to include with the order. Both will use the same data inputs, but produce two different looking documents.

Using conditional logic, you will define which documents should be merged based on the values of pre-defined variables. This means you can also send the data from one data feed to documents if the values match. For example, if the payment status is incomplete on the order, you might want to send an invoice instead of a receipt. Here is an example:

data-route-rules-with-logic.png

Each Route you create has a specific Webhook URL that you will use when hooking up your data feeds. You will use this URL instead of the URL for your document.

Have more questions? Submit a request

6 Comments

  • Avatar
    David Kunze

    Hi, I want to create multiple documents (same document types, but different input values) from multiple related Salesforce records.
    Basically, on my webmerge mapping I have a field called $list which is a SOQL field grabbing all necessary data from records. On my data route,under rules, I created a rule that has "combined in one PDF" and " repeat this rule" ticked to loop through each record from that SOQL, and in "repeat this rule using the field (array)" I have put {$list}, but when I put "{$list.Testfield__c}" in my target document (which is an excel file) it generates a pdf file with a page for each record (so, this works), BUT the pages don't contain any passed values, like it didn't grab any data (in debug, the data are there with attributes {$list.1.Testfield__c,{$list.2.Testfield__c}},etc). I probably need to added some code to target document or to rule, but couldn't figure out what. Any advice. Thanks

  • Avatar
    Jeremy Clarke

    Hi David,

    When using the "Repeat this Rule" option, it's going to send the values of the individual item in the array. So if your $list array has items with "Testfield__c" as a value, then you'll just need to use {$Testfield__c} in your document not {$list.Testfield__c}

    Thanks!

  • Avatar
    Ross Goldberg

    Hello! I am creating a route that will create one primary document, but need to add additional pages for related records. I see how to repeat a rule based on an array, but in my case the primary document already includes the info for the first record in the array, so I only need to repeat the rule from the 2nd to the nth child records. Both documents are fillable PDFs, so I am wanting to control the output via the route rules. Please let me know how I can achieve this.

    Thanks!

  • Avatar
    Jeremy Clarke

    Hi Ross,

    You can create a new array, ignoring the first item, using array_slice($people, 1) -- so in your "Repeat this rule" box, you'll enter something like this:

    {$_people = array_slice($people, 1)}{json_encode($_people)}

  • Avatar
    Laura Quinn

    Hi! I am trying to include a document in a route only if a particular field isn't blank. What specific syntax should I use to do this? I assume that it's some variation of the field Equals NULL or Equals !Empty or Is Not Equal to "" or something but none of the ones I've tried work...

  • Avatar
    Jeremy Clarke

    Hi Laura,

    You can actually just leave the "value" box empty :) So your logic will look like

    If [Field] Not Equal To [EMPTY BOX]

Please sign in to leave a comment.
Powered by Zendesk