Merge fields in templates
A merge field is a placeholder that gets replaced with real data when the message goes out. They are written with the record type first, then the field:
{{customer.company_name}} {{contact.first_name}} {{opportunity.name}}
The part before the dot says which record the value comes from. The part after the dot is the field on that record.
These are the record types an email template can draw on, and there are no others:
- the contact and the lead — the person being written to;
- the report subject: the contact or lead the email is about, independent of who receives it;
- the customer — the company;
- the opportunity — the deal, including its name, number, stage, value, currency, probability and close date;
- the activity — a task or meeting, including when it starts, how long it runs, where it is and the link to join;
- the current user — whoever is sending;
- general values such as today's date and your own company's details.
Listing what the customer bought. A deal's quote lines — the advert type, the product, the service, whatever each line is called — can be printed straight into a template. Two fields do it:
{{opportunity.quote_lines}} {{opportunity.quote_line_names}}
The first prints a small table with a row per line: the line's name, how many, and the amount. Anything charged monthly or yearly says so on its own row, so a recurring price is never mistaken for a one-off. The second prints only the names, separated by commas — the one to use in a subject line or inside a sentence.
Put the table field on a line of its own in a text block. A deal with no quote lines prints nothing at all rather than an empty table, so a template that uses it is safe to send for any deal.
Products themselves are not a record type. There is no {{product.…}} field, so a tag like that stays in the message as visible braces. Reach a product through the quote line it sits on, using the fields above.
Insert them from the picker rather than typing them. The template editor offers the merge fields that actually exist for your company, grouped by record type. Typing one from memory is how you end up with a tag that never resolves, because the field name has to match exactly.
Your custom fields work too. A field your company added is available under its own name, for example {{opportunity.webcrm_OpportunityCustom1}}. These appear in the picker alongside the built-in ones, so you do not need to know the internal name.
Which fields resolve depends on where you send from. A merge field only fills in if that record is part of the send. An {{opportunity.…}} tag has nothing to draw on when the email is sent from a customer with no opportunity attached, and a {{contact.…}} tag needs an actual contact as the recipient rather than a plain email address.
Putting a photo in the email. Two of the Current User fields are pictures rather than text, and each comes in two forms. The plain one drops the picture itself into the message:
{{current_user.avatar_image}} {{current_user.organisation_logo_image}}
The "address only" one gives you just the web address of that picture, for pasting into the URL box of an image block:
{{current_user.avatar_url}} {{current_user.organisation_logo_url}}
Use the plain form in a text block. A field that ends in _url is only the address, so putting it in a text block sends the recipient a line of text that looks like a link, not a photo. If the sender has never uploaded a profile photo, the picture form simply leaves a blank rather than a broken image, so check the person has a photo first. An admin can set one for anyone: Add users and set what they can do.
Use the preview before sending. Välj en affär eller ett företag för att se dataförhandsgranskningen… Previewing against a real record is the only reliable way to see what your recipients will get.
Sending a report about someone to a different person. Open the composer from the record whose contact the report describes. Use {{subject_contact.full_name}}, {{subject_contact.email}}, {{subject_contact.phone_mobile}}, {{subject_contact.job_title}} and {{subject_contact.linkedin_profile_url}} for that person's details. These stay with the original record when you change the recipient, including an address that is not a contact in your workspace. If the record supplies no contact or lead, these fields remain unfilled; a company alone does not choose a person for you.
Keep {{contact.first_name}} for a greeting to the recipient. Changing the recipient refreshes the template preview; an unknown recipient leaves their personal fields unfilled instead of showing the previous person's details. Existing report templates need their descriptive contact fields replaced with the report-subject fields once. Existing greeting fields keep their meaning.
Var det här till hjälp?