CMS Development

PD_
Contributor

Quote template using crm_associations() HubL function

Background

 

I'm trying to use the crm_associations() HubL function in a custom quote template to look up companies associated with the deal. A deal can have two companies: one is the purchaser, and the other is a consultant that assists the purchaser with installation of our product. We use custom association types to represent these different types of deal-to-company associations.

 

For each quote I'm trying to look up both companies so each one can be included on the quote template.

 

Problem

 

The problem is that no matter what I try, the crm_associations() function always returns an object with a total of 0 and an empty results array.

 

Here's an example of what I've tried that I think should work:

 

{% set deal_consultant = crm_associations(deal_id, "USER_DEFINED", 111, "limit=3") %} 

 

 

I noticed that the function documentation mentions "Please note: for security purposes, of the HubSpot standard object types only the product, and marketing_event objects can be retrieved on a publicly accessible page."

 

Questions

 

Do quote templates count as "publicly accessible" pages?  Is this the reason I'm not getting any results?

 

Is there a way to password protect a quote such that I can actually make use of the crm_associations function? Or is there any other way to show both companies on a quote?

0 Upvotes
2 Replies 2
alyssamwilie
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Quote template using crm_associations() HubL function

Since the quotes crm object is also only allowed on private pages I can't imagine quotes themselves would be counted as public.

 

Is 111 the correct association ID for ya'll's custom association?

If you output deal_id in the quote is it actually returning a value?

 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
PD_
Contributor

Quote template using crm_associations() HubL function

I output the deal ID that I'm using in the function and it was correct.

 

I confirmed that 111 is the correct association type ID. When I use the Associations API ( https://api.hubapi.com/crm/v4/objects/deal/<DEAL_ID>/associations/company ) I get back the response below ( toObjectIds have been modified). You'll see that one of the results has a typeId of 111.

 

{
    "results": [
        {
            "toObjectId": 10111111111,
            "associationTypes": [
                {
                    "category": "HUBSPOT_DEFINED",
                    "typeId": 5,
                    "label": "Primary"
                },
                {
                    "category": "HUBSPOT_DEFINED",
                    "typeId": 341,
                    "label": null
                }
            ]
        },
        {
            "toObjectId": 10222222222,
            "associationTypes": [
                {
                    "category": "USER_DEFINED",
                    "typeId": 111,
                    "label": "Consultant"
                },
                {
                    "category": "HUBSPOT_DEFINED",
                    "typeId": 341,
                    "label": null
                }
            ]
        }
    ]
}

 

 

0 Upvotes