Merge field $aos_contracts_reference_code doesn't fill anything

I’m putting my contracting process into SuiteCRM, and want to use a unique ID for referring to the contracts. Something like:

Contract Number: $aos_contracts_reference_code

This would be sufficient, but $aos_contracts_reference_code doesn’t return any value.

Tested on SuiteCRM 7.11.23 (UCS install – yes, I know I should upgrade) and 8.1.3 (the public demo instance)

Is anyone using $aos_contracts_reference_code successfully?

Hi, welcome to the Community! :tada:

Where exactly are you trying this variable substitution? Which screen, which option, etc?

Contract PDF Template, called from the contract screen.

I’ve checked, and other variables like $aos_contracts_start_date and $aos_contracts_status do populate properly (under 7.11.23, anyway, but I don’t have any reason to suspect a regression).

Right –

So, I expected that the reference code was a unique value (DB key value or something). But it wasn’t visible on the views, so I couldn’t see it.

I’ve added it to the views through Studio, and the field is empty, which is why the variable isn’t being filled in. So that part of the mystery is solved.

Now I just need to figure out how to autogenerate a serial number and combine this with a related field to produce the unique ID.

If your id can be ugly, you can use the id field which is the GUID used in the database.

If you need more of a serial-number-presentable-to-a-customer, you might need to create an auto_increment field, there are several posts here in the Forums about that, for example:

I am the author of a paid add-on that greatly enhances template capabilities, it’s called PowerReplacer. That can also be used to facilitate automatic numbering and many other things.

Thanks for the hints – I’m working on it.

Can I also use system variables (system name, address, etc) in templates? They’re not visible in the drop-down selector.

Is there a complete list of stock fields and their variable names somewhere?

There’s a reason why I went ahead and re-wrote the whole thing :sweat_smile:

People always need more than what the system provides…

So… the system variables: sorry, no, I don’t think they’re available. Sometimes you can create clever schemes of putting things in fields so that you can access them in the templates.

About the complete list of fields; again, no, there isn’t, although there are a couple of ways that can get you close enough. One is the database schema which is available online:

suitecrm Database

Where you can browse tables and fields. And relationships.

Then there are the vardefs files throughout the directory tree of SuiteCRM, with all the fields defined in there. This is basically what you see in Studio, although in Studio you have to click on each field individually to see the internal name.