• Help Desk reporting gives you real-time visibility into your support operation without the manual work. Ask our experts about which metrics matter most! AMA Dec 8-12.

    Ask us anything

Quotes w/ Contacts from 2 Companies, Need Company Name for Contacts from non-Primary Company

navroop
Contributor

(Apologies on the long initial post, but figured I'd try to answer some Qs up front)

 

Background:

We principally sell to Enterprise customers who actually purchase our product from a Reseller, who gets the product from a Distributor, who ultimately has the order fulfilled by us.

90% of our Quotes will actually be from us to the Distributor, who will then add their own markup and on their own paper send a Quote to a Reseller, who will do the same and then send their own quote to the Customer.

Because Customers may elect to renew via a different reseller in the future and because our support teams, etc engage directly with the Customer for all other matters other than this step in procurement, it's important to us to track the end Customer the product is going to.

 

We successfully customized our Quotes to reflect the End-Customer Company, Contacts at the End-Customer, as well as a Reseller Contact.

 

During Quote Generation, when selecting customer contacts to associate with the Quote, our Sales Team will also select a contact from the Reseller (to whom the Distributor will send their quote).

 

In order to process the Quote Associated Contacts to the correct columns on the quote, we added a custom property to Contacts "Reseller" that accepts a boolean Yes/No value. 

 

When processing Buyer Contacts then, we exclude Contacts that are resellers.

 

{% for recipient in BUYER_CONTACTS %}
{% if recipient.reseller != true %}
{% if module.show_contact_name %}
<span>
<b>{{ format_name(recipient.firstname, recipient.lastname, true) }}</b>
</span>
<br>
{% endif %}

....

 

Then when processing information for the Reseller column on the customized Quote, we only include those associated contacts identified as a Reseller.

 

{% for reseller in RESELLER_CONTACTS %}
{% if reseller.reseller == true %}
{% if module.show_reseller_name %}
<span>
<b>{{ format_name(reseller.firstname, reseller.lastname, true) }}</b>
</span>
<br>
{% endif %}

 

...

 

Question? / Where we've hit a snag

The above works beautifully. The only nice-to-have we'd like to update now is the inclusion of the Company name for the Reseller Contact.

 

We had hoped updating the above with this would work...but the section in bold does not return a value / the company name.

 

I understand this to be because the Company Name property on a contact is not linked to the Name on the Associated Company.

 

Since the Associated Company name could change (we've seen this recently during M&A for one of the big resellers), we don't want to use a Workflow to update contacts.

 

Is there a way to make the below work by looking up the AssociatedCompanyId (or similar) for the Reseller contact(s) and then using that Id look up the name property for the Company record with that AssociatedCompanyID? (I may have the property names wrong...very new to this)

 

Reseller:<br>
{% for reseller in RESELLER_CONTACTS %}
{% if reseller.reseller == true %}
{% if module.show_reseller_name %}
<span>
<b>{{ format_name(reseller.firstname, reseller.lastname, true) }}</b>
</span>
<br>
{% endif %}

{% if module.show_reseller_company_name and reseller.company %}
<span>
{{ reseller.company }}
</span>
<br>
{% endif %}

{% if module.show_reseller_job_title and reseller.jobtitle %}
<span>
{{ reseller.jobtitle }}
</span>
<br>
{% endif %}

{% if module.show_reseller_email and reseller.email %}
<span>
{{ reseller.email }}
</span>
<br>
{% endif %}

{% if module.show_reseller_phone and reseller.phone %}
<span>
{{ reseller.phone }}
</span>
<br>
{% endif %}
<br>
{% endif %}
{% endfor %}

16 Replies 16
Teun
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Hi @navroop ,

 

You could try using the crm_associations function, but I'm not sure if you are allowed to do so in a quote:

{% for reseller in RESELLER_CONTACTS %}
  {% if reseller.reseller == true %}
    {% if module.show_reseller_name %}
      <span>
        <b>{{ format_name(reseller.firstname, reseller.lastname, true) }}</b>
      </span>
      <br>
    {% endif %}

    {% if module.show_reseller_company_name and reseller.company %}
      {% set companies = crm_associations(reseller.hs_object_id, "HUBSPOT_DEFINED", 1, "limit=1", "name") %}
      {% if companies.results[0] %}
        <span>
          {{ companies.results[0].name }}
        </span>
      {% endif %}
    {% endif %}

    {% if module.show_reseller_job_title and reseller.jobtitle %}
      <span>
        {{ reseller.jobtitle }}
      </span>
      <br>
    {% endif %}

    {% if module.show_reseller_email and reseller.email %}
      <span>
        {{ reseller.email }}
      </span>
      <br>
    {% endif %}

    {% if module.show_reseller_phone and reseller.phone %}
      <span>
        {{ reseller.phone }}
      </span>
      <br>
    {% endif %}
    <br>
  {% endif %}
{% endfor %}


 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


navroop
Contributor

I tried the code out. No dice. 

 

But, I did some digging and the CRM Associations function should be available in Quotes per this post: https://developers.hubspot.com/docs/cms/hubl/variables/quotes

 

"You can also look up a custom object by using the crm_associations() function and crm_objects() function"

 

So, I can't tell if its a syntax error, bad association type (1 vs 2), a security issue, or other problem? 

0 Upvotes
navroop
Contributor

I did see another post about someone replacing hs_object_id with vid to get a different call working, but I thought those two were equivalent...

0 Upvotes
Teun
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Hi @navroop ,

 

Quick check, do you get an output if you use {{reseller.hs_object_id|pprint}}?



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
Teun
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Just to rule out some other issues, could you try this;

{% set companies = crm_associations(reseller.hs_object_id, "HUBSPOT_DEFINED", 1, "limit=1", "name") %}
{{companies|pprint}}
{{reseller.hs_object_id|pprint}}
{% if companies.results[0] %}
  <span>
   {{ companies.results[0].name }}
  </span>
{% endif %}

Also, you could try this ID as well, as it is another association label between contacts and companies that is HubSpot defined:

{
    "results": [
        {
            "category": "HUBSPOT_DEFINED",
            "typeId": 279,
            "label": null
        },
        {
            "category": "HUBSPOT_DEFINED",
            "typeId": 1,
            "label": "Primary"
        }
    ]
}


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


navroop
Contributor

Just to see if there's something else going on, I modified the code as follows.

 

{% for reseller in RESELLER_CONTACTS %}
{% if reseller.reseller == true %}
Reseller Print Initial IF Statement<br>
{{reseller.hs_object_id|pprint}}
{% if module.show_reseller_name %}
<span>
<b>{{ format_name(reseller.firstname, reseller.lastname, true) }}</b>
</span>
<br>
{% endif %}

{% if module.show_reseller_company_name and reseller.company %}
{% set companies = crm_associations(reseller.hs_object_id, "HUBSPOT_DEFINED", 1, "limit=1", "name") %}
Companies Inner IF Statement<br>
{{companies|pprint}}
Reseller Inner IF Statement<br>
{{reseller.hs_object_id|pprint}}
{% if companies.results[0] %}
<span>
{{ companies.results[0].name }}
</span>
{% endif %}
{% endif %}

 

The output never includes the even the labels for those inner IF statements.

 

Output is below:

 

Reseller Print Initial IF Statement
(Integer: 311351)

0 Upvotes
navroop
Contributor

Missed the obvious first problem (the outer if include checking for reseller.company which is blank and would come from the contact record.)

 

Removing that obvious problem now I get the following output:

 

Companies Inner IF Statement
(CrmObjectList: {hasMore=false, offset=0, results=[], total=0}) Reseller Inner IF Statement
(Integer: 311351) 

 

So there are 0 results using type 1. 

 

Using type 279

 

Companies Inner IF Statement
(CrmObjectList: {hasMore=false, offset=0, results=[], total=0}) Reseller Inner IF Statement
(Integer: 311351) 

 

Which is the same.

 

I did validate that navigating to the contact record does show a valid associated company that does have a valid name.

0 Upvotes
navroop
Contributor

Yes, that prints out (Integer: 311352)

0 Upvotes
Teun
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

@navroop Is it a default association between the company and contact or one with a custom association label? If it is a custom association label, we need to use 'USER_DEFINED' and the relevant association ID. 
These are the default ID's we can use, but you could check if there are other associations by making an API call to: 
https://api.hubapi.com/crm/v4/associations/contact/companies/labels



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
navroop
Contributor

Should be the default association. We've never customized that (as far as I know).

 

I'm very new to this, so not sure how to make that call...

0 Upvotes
Teun
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Last try before I have to try to reproduce this in one of my custom quotes:

{% set contactId = reseller.hs_object_id ? reseller.hs_object_id : 0 %}
{% set companies = crm_associations(contactId, "HUBSPOT_DEFINED", 1, "limit=10", "name,domain", false) %}
{{companies|pprint}}


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
navroop
Contributor

Hi @Teun were you able to replicate this issue? Any other ideas on how to solve it? Literally the last thing to solve before we go live with our new quoting via Hubspot.

 

Really appreciate your help.

0 Upvotes
navroop
Contributor

Were you able to replicate the issue? I've tried multiple combinations and haven't been able to get the company data out. I don't see any evidence of us using a custom association.

0 Upvotes
navroop
Contributor

Same result. All other output is exactly as expected.

 

Companies Print:
(CrmObjectList: {hasMore=false, offset=0, results=[], total=0})
Reseller Print:
(Integer: 311351) 

 

Code now looks like this:

 

{% set QUOTE = template_data.quote or mock_data.quote %}
{% set RESELLER_CONTACTS = QUOTE.associated_objects.contacts %}

Reseller:<br>
{% for reseller in RESELLER_CONTACTS %}
{% if reseller.reseller == true %}
{% if module.show_reseller_name %}
<span>
<b>{{ format_name(reseller.firstname, reseller.lastname, true) }}</b>
</span>
<br>
{% endif %}

{% if module.show_reseller_company_name %}
{% set contactId = reseller.hs_object_id ? reseller.hs_object_id : 0 %}
{% set companies = crm_associations(contactId, "HUBSPOT_DEFINED", 1, "limit=10", "name,domain", false) %}
<br>Companies Print:<br>
{{companies|pprint}}
<br>Reseller Print: <br>
{{reseller.hs_object_id|pprint}}
{% if companies.results[0] %}
<span>
{{ companies.results[0].name }}
</span>
{% endif %}
{% endif %}

{% if module.show_reseller_job_title and reseller.jobtitle %}
<span>
{{ reseller.jobtitle }}
</span>
<br>
{% endif %}

{% if module.show_reseller_email and reseller.email %}
<span>
{{ reseller.email }}
</span>
<br>
{% endif %}

{% if module.show_reseller_phone and reseller.phone %}
<span>
{{ reseller.phone }}
</span>
<br>
{% endif %}
<br>
{% endif %}
{% endfor %}

0 Upvotes
BMac2
Member

Did you ever get this working with the associated company to the reseller contact? 

Is there an option to pull an associated company label reseller from the deal into the Quote? 

0 Upvotes
navroop
Contributor

@Teun were you ever able to replicate? Not a blocker for us at the moment, but would still be helpful to address.

0 Upvotes