Start a new topic

Smart Documents

I'm struggling to find documentation on creating smart document templates, can you point me in the right direction?


Thank you.

1 Comment

George,


Unfortunately, we do not have any documentation online at this time around smart document templates.  They are very similar, however, to barcode templates, which are documented here:  https://support.infopluscommerce.com/support/solutions/articles/11000023929-create-and-use-a-barcode-template


As mentioned in the article on barcode templates, to really use a smart document template, you also need access to the infoplus api developers reference, to know what variable fields you have access to, from the record you are working with in your template.  See http://developer.infopluscommerce.com/api/reference/v2.0/ for those field names (and make sure the the version of your smart document matches the version of the api reference you're on).


An extra word of advice - the Code field of a smart document is rendered into HTML (and then PDF) using the Velocity Templating Language, which gives you access to basic programming structures, such as variables, logic, and loops.  The full Velocity user guide is at: http://velocity.apache.org/engine/1.7/user-guide.html


Finally, if you're trying to pull together data from more than a single record, and combine it all into a one smart document, you may need to use a Script to customize your smart document.  To do this, create a new Script in Infoplus, and choose the Script Type of "Smart Document".  In a Smart Document type Script, you have access to the same record variable that your smart document has access to, and you can use the infoplusApi object to look up additional data.  To make data from your script available in your template, you must "put" it into a variable called "output". 


Here's an example of this kind of script, where the input record has a field called vendorId, and it needs to look up the full vendor record, to be used by the template:


var vendor = infoplusApi.getById("Vendor", record.vendorId);
output.put("vendor", vendor);


Let us know if you have any further questions, or if we can help you get a specific template up and working.


Login or Signup to post a comment