PDF templates - module insert fields not showing

In suitecrm 7.11.5 I run into problem with pdf templates.
When I choose module type in create template, in insert field module fields are not showing.
Insert module name changes fine but individual fields do not work.

In console it prints an error
Uncaught ReferenceError: regularOptions is not defined
It’s printed by a function: populateVariables which after taking a look in the code is indeed there to populate insert fields. I could not find where populateVariables should be defined.

In addition in order to write this post and use correct terminology I changed my CRM language to English instead of Polish. Strangely enough this issue is non existent in English version fields show up fine, even for custom module I just added.

Can anyone help me shed some light on this issue?

edit forgot to add:
populateVariables can be found at modules/AOS_PDF_Templates/AOS_PDF_Templates.js

for which module are you generating the PDF template? check out if that has your language file something like modules/Accounts/language/pl_pl.lang.php and for your custom Dropdown options you can add language in the module custom folder path.

Thanks for quick reply
I wanted to create template for accounts and a custom module I created. But above mentioned issue is true for all modules in pdf template creator.

Language files exist for all the modules mentioned in pdf templates.

I’m unsure what you meant with Dropdown and how it can help fix my problem with fields not showing. If you could elaborate here.

Below are 2 pictures one in polish and other in English to show the difference in modules, Account label in polish is renamed to Darczyńcy. Also the insert variable list is open in first picture you can barely see it because it’s empty.

For a quick solution, you can create the PDF template using english language and insert the variables. i would need to install polish language pack and check if its a hard coded module name look up to make the variables list in PDF templates.

In the end my co-workers are going to work with pdf templates so I would be thankful if you could check out the polish language pack. On a side note I’ve seen it work in the past on a different instance with polish language.

Do you see any javascript errors in your browser’s developer console, when you use the Polish language pack? Any errors that show only in Polish version?

The same check would be useful for the SuiteCRM logs.

As I wrote in the 1 post there is a JS error in console:

Uncaught ReferenceError: regularOptions is not defined caused by function populateVariables in modules/AOS_PDF_Templates/AOS_PDF_Templates.js
The error only appears in console in Polish version, in English it’s doesn’t appear and functionality works fine.

As for logs, nothing shows up.

Look for some bug in


in the Polish language pack. Things like un-escaped apostrophes (')

It looks fine to me but to be certains I’ll post them below:

// From include/languages
$app_list_strings['pdf_template_type_dom']['AOS_Quotes'] = 'Oferty';
$app_list_strings['pdf_template_type_dom']['AOS_Invoices'] = 'Faktury';
$app_list_strings['pdf_template_type_dom']['AOS_Contracts'] = 'Umowy';
$app_list_strings['pdf_template_type_dom']['Accounts'] = 'Kontrahenci';
$app_list_strings['pdf_template_type_dom']['Contacts'] = 'Kontakty';
$app_list_strings['pdf_template_type_dom']['Leads'] = 'Potencjalni Klienci';

// and custom/include/languages
$GLOBALS['app_list_strings']['pdf_template_type_dom']=array (
  'AOS_Quotes' => 'Oferty',
  'AOS_Invoices' => 'Faktury',
  'AOS_Contracts' => 'Umowy',
  'Accounts' => 'Darczyńcy',
  'part_Partnerzy' => 'Partnerzy',
  'Contacts' => 'Kontakty',
  'Leads' => 'Potencjalni Klienci',

Compare with the english version you have. Maybe it is missing a definition for some other module, a custom module perhaps?

You can also try checking the rendered JS in your browser’s sources. It should have a line with var regularOptions = ..., you can check if that looks ok.

I would expect you have another JS error, before the one you posted, when it’s failing to set the variable…

Okay, I managed to fix the issue on accident while fixing my past co-worker mistake. He had job to create a similar module to one and in his disregard he created a faulty module with with some issues one of them being labels. His custom module was added to PDF templates and one label while creating array for pdf templates it passed an empty value without quotes which was breaking array creation.

Also as @pgr said, like a rookie I was reading wrong error in console. The actual message was 2 lines above.

After finding the cause I fixed it by accident by redeploying my colleague module with my fixes.

Thank you everyone for helping me.

1 Like