Personalized Signature on Quotes

Hi! I’m working on personalize quote module for quote signature.
The standard code is:


{# Localize the ordering of first and last name #}
{% macro localize_signer_names(signers, use_honorific) -%}
{% for signer in signers %}
{% set signer_full_name = format_name(signer.first_name, signer.last_name, use_honorific) %} 
{% do signer.update({ "full_name": signer_full_name }) %}
{% endfor %}
{%- endmacro %}

Now I need to add signer.company (fields taken from contact record) in signer_full_name, if I add:

{% set signer_full_name = format_name(signer.company, signer.first_name, signer.last_name, use_honorific) %}

It doesn’t work.
In what module I’ve to setup also company field?
Thanks

Hi @Pietro-Poli-,

Thanks for reaching out to the Community!

I would like to invite some members of our community who may offer valuable insights.— hey @Balaji_Mavlers1, @Josh, @EMalueg - Could you share your advice with @Pietro-Poli-?

Thanks for taking a look!

Diana

What does your format_name macro look like?

{% set signer_full_name = format_name(signer.first_name, signer.last_name, use_honorific) %} 

{# this would likely be #}
{# adding in whatever the use_honorifc does #}
{% macro format_name(firstname, lastname, use_honorific) %}

 {{ firstname ~ ' ' ~ lastname }}
{% endmacro %}

So if you are sending the company name signer.company so that is appearing as the first item instead of firstname
So you need to make a new macro, or update that macro. If that macro is something in the quotes as a default item, you’d just need to make a macro that helps you figure this out.k.

Hi @nickdeckerdevs1
my code is this

If I add company nothing is shown.
I need to understand where I’ve to add company

Hi @Pietro-Poli-

The issue you’re encountering with adding signer.company directly into the format_name function is likely because company is not a default property directly available within the signer object in the quote signature module. The signers object primarily contains basic contact information like first name and last name.

To include the company name, which is typically associated with the contact record in HubSpot, you’ll need to access the associated company information for each signer. This usually involves using HubSpot’s crm_associations function within your HubL code to retrieve the company linked to the contact who is designated as the signer.

Here’s a breakdown of why your approach didn’t work and how to correctly implement it:

Why format_name(signer.company, signer.first_name, signer.last_name, use_honorific) Fails:

The format_name function is designed to format a name using provided first name, last name, and optionally an honorific. It does not have a parameter or built-in capability to handle a company name in that position.

How to Correctly Include the Company Name:

You need to retrieve the company associated with the signer contact object separately and then construct the full name string yourself, incorporating the company name where you want it to appear.

Here’s a conceptual example of how you might modify your macro, keeping in mind that the exact implementation might vary slightly based on the specific structure of the signer object and available HubL functions in your quote module environment:

{# Localize the ordering of first and last name #}
{% macro localize_signer_names(signers, use_honorific) -%}
{% for signer in signers %}
 {# Attempt to get the associated company for the signer's contact record #}
 {% set associated_companies = crm_associations(signer.hs_object_id, "HUBSPOT_DEFINED", 1, "limit=1", "name") %} {# Assuming hs_object_id is the contact ID #}

 {% set signer_full_name = format_name(signer.first_name, signer.last_name, use_honorific) %}

 {% if associated_companies.results %}
 {% set company_name = associated_companies.results[0].name %}
 {# Construct the full name including the company name #}
 {% set signer_full_name_with_company = signer_full_name ~ ", " ~ company_name %} {# Example: "John Doe, HubSpot" #}
 {% do signer.update({ "full_name": signer_full_name_with_company }) %}
 {% else %}
 {% do signer.update({ "full_name": signer_full_name }) %}
 {% endif %}
{% endfor %}
{%- endmacro %}

Where to Set Up the Company Field:

The company information itself is stored on the Company record in HubSpot and linked to the Contact record. When you associate a contact with a deal and then create a quote from that deal, HubSpot pulls information related to the contact and associated company.

You don’t need to “set up” the company field specifically within the quote module code. Instead, ensure that:

  • The contacts who will be signing the quote have an associated company in your HubSpot CRM.
  • The quote is associated with the correct deal and contacts.

By using crm_associations in your quote template code, you are accessing the existing company data linked to the signer’s contact record.

Thanks for doing this. I haven’t had time to get into a quote template to build this out and make a response like this. Appreciate you!

thank @Balaji_Mavlers1