Hi I'm using `render.transaction()` in SuiteScript...
# suitescript
s
Hi I'm using
render.transaction()
in SuiteScript 2.x to generate a PDF of transaction records.
Copy code
var pdfAttachment = render.transaction({
    entityId: recordId,
    printMode: render.PrintMode.PDF
});
This works correctly for Journal Entries and Bill Payment records, but when I pass the internal ID of a Check transaction, it throws an error and no PDF is generated. The Check transaction has a print template assigned under the transaction form. I also noticed that manually printing a Check in the UI typically requires using the "Save and Print" button. My questions are: 1. Does
render.transaction()
support Check transactions? 2. Are Check PDFs generated differently from other transaction types? 3. Is there any additional setup required (advanced PDF template, check layout, print flag, etc.) for Check records? 4. If
render.transaction()
is not supported for Checks, what is the recommended way to generate or email a Check PDF from SuiteScript? Has anyone successfully generated a Check PDF using
render.transaction()
?
g
Happy Monday! I've been messing with this a bit recently. Issue is in the pdf template and how it expects data to come in. The check templates always expect an array, render.transaction does not send an array and as far as I can tell there is no way to change that. So in the template you can do something like this based on your setup and it'll work.
Copy code
<#if records??>
		<#assign checkList = records>
	<#else>
		<#assign checkList = [record]>
	</#if>
	<#list checkList as check>
👍 1
If you want the quick verification you can just edit your template down to a simple hello world and your error should resolve.
s
ok let me check thanks