Help with the Insert Fields in the PDF - Templates

So I made a custom module(“test”), that module has a custom ‘line items’-like fields that was made using smarty template and is saved in a different database table.

I’ve added a print to pdf button inside the “test” module. Then I tried to add pdf template for the test module. However, in the first input in the Insert fields, I don’t have something that references the data for my custom line items.
I only have these default ones:

What I want is something like this:


The Quotes have a reference to the individual line items via the “Line Items : Products” option in the dropdown.

I want to achieve the same thing with my custom module, but I lack the knowledge to do so… Any form of help is appreciated…

This should help

Thank you for your reply @pgr

I’ve already read that pdf. I have print to pdf button. I also made a template and I can definitely print a pdf using that button.

My only problem is most probably have to do with relationship(which I have little knowledge about it). I can select the custom module in the pdf template maker but I can’t get the related values(which is in a different module) in the second Insert field input…

If your question is about how to navigate on PHP to the related data, see load_relationship or get_linked_beans here:

If your problem is with the “Insert fields” dropdowns, that’s a little more complicated, you’d have to investigate the moment when the PDF template screen is generated…

But then - if you need a loop inside the template, to produce a table or a list from the line items… that’s just not something currently possible with SuiteCRM. I did that on my PowerReplacer add-on but it involves a different “engine”…