Forum Discussion

JimHarrison's avatar
JimHarrison
Qrew Champion
2 days ago

Doc Gen Replacing filename error

Leaving this here for you. 
Ran into a problem where when I printed the Doc, it showed this crazy error. 

{"message":"Bad Request","description":"This document template has field markers that require a Record ID."}

What does that mean? 
If you look at the two URL's of the Print button below, the second is cut off. 

var text fileName = "template";

https://api.quickbase.com/v1/docTemplates/1/generate?&tableId=bkp8cwnzs&realm=hardermech.quickbase.com&format=pdf&pageSize=Letter&filename=template&margin=0.25%200.25%200.25%200.25&unit=in&orientation=portrait&recordId=3364

var text fileName = [Override Template Name];

https://api.quickbase.com/v1/docTemplates/1/generate?&tableId=bkp8cwnzs&realm=hardermech.quickbase.com&format=pdf&pageSize=Letter&filename=512604-19254.Oregon.Summit 
this one is missing all this stuff at the end: "&margin=0.25%200.25%200.25%200.25&unit=in&orientation=portrait&recordId=3364"

Here is how I fixed it. I moved the filename variable to the end of the URL. 

var text url = "https://api.quickbase.com/v1/docTemplates/1/generate?&tableId=" & $tableId & "&realm=" & $qbRealm &"&format=" & $format &"&pageSize=Letter&margin=" & $margin &"&unit=in&orientation=portrait&recordId=" & ToText([Record ID#])&"&filename=" & $fileName;

Not sure if this is known or not but leaving it here for future me. 

No RepliesBe the first to reply