APIs & Integrations

Zayne
Contributor

Accessing a deal that is associated to the current deal from a quote template

I have an interesting use case. Our renewals department wants to be able to show the previous deal's information (line items, totals, etc) on the new deal's quote, so that the customer can see the difference between the 2. I have linked the 2 deals together with the association labels "previous" and "next". I was hoping to be able to access the previous deal by doing something like this:

 

 

{#{% set previous_deal = crm_associations(template_data.quote.associated_objects.deal.hs_object_id, "USER_DEFINED", 271) %}#}

 

 

This however doesn't return anything.

 

Is this even possible?

2 Replies 2
Humashankar
Key Advisor

Accessing a deal that is associated to the current deal from a quote template

Hi @Zayne 

 

Seems the code requires few adjustments to access previous deal information using the HubSpot COS templating language.

 

Navigate to Settings > Objects > Deals, then click on the "Manage" button under the Associations section. Locate the association with the display name "previous" and with that ID, which you'll use to replace the USER_DEFINED and 271 values in your code.

 

This will ensure you're referencing the correct association and can access the previous deal information as needed

 

The problem is that association labels like "previous" and "next" are stored as display names, not the actual association type ID.

 

This will help you accurately access the previous deal information.

 

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

Humashankar VJ
HubSpot Community Champion and enthusiast | Engineering Manager
0 Upvotes
Zayne
Contributor

Accessing a deal that is associated to the current deal from a quote template

That's exactly how I got to those values: 271 is the id for that particular association.  It seems the issue is that you can't actually access other deals within the same quote. 

0 Upvotes