Hi
!
anyone… need help in creating a module for quote template. The module should simply fetch all deal associated contact with their labels.
ex. Fullname, association label
Thanks!!!
Hi
!
anyone… need help in creating a module for quote template. The module should simply fetch all deal associated contact with their labels.
ex. Fullname, association label
Thanks!!!
Hi @ZoMi
HubSpot doesn’t offer a built-in “Association Label” module that you can directly add to quote templates
You can create a custom code that utilizes the HubSpot Workflows API to fetch the necessary data
Create a workflow that triggers on “Deal: New” or another relevant event.
Within the workflow, add a custom code snippet action.
This code will use the Workflows API to:
Make use of the knowledge base for more help
Create and use association labels (hubspot.com)
Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards
Thanks Humasshankar,
I allresdy have a flow that populates properties baesd on contact association label, but I wanted directly to loop trough deal associated contacts and based on their association label add them to specific places in my quote. So this is not posible with labels… :-(. Maybe it’s easier to fetch the data from workflow properties, but this I’ll need to research on how to.
Option1:
I found the following in some threads and I was wondering if it could be used?, and if yes then if it could be modefied to fetch my defined "TypId"s “labels”?
{% set quote_associated_object = crm_associations(template_data.quote.associated_objects.deal.hs_object_id, "USER_DEFINED", "association type ID", "limit=200", "property field that you need to fetch from the custom object - internal name", false) %}
Option2:
Is it posibel to pre-define the quote code with my labels and based on “TypeId” or “label” achive what I want?
Using this endpoint : https://api.hubapi.com/crm/v4/associations/0-3/0-1/labels
I get this responce:
{
*"results": \[*
*{*
*"category": "HUBSPOT\_DEFINED",*
*"typeId": 3,*
*"label": null*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 3,*
*"label": "Borgensperson 2"*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 15,*
*"label": "Firmatecknare 4"*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 5,*
*"label": "Borgensperson 3"*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 9,*
*"label": "Firmatecknare 1"*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 17,*
*"label": "Kredittagare"*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 11,*
*"label": "Firmatecknare 2"*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 7,*
*"label": "Borgensperson 4"*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 1,*
*"label": "Borgensperson 1"*
*},*
*{*
*"category": "USER\_DEFINED",*
*"typeId": 13,*
*"label": "Firmatecknare 3"*
*}*
*]*
}
Hi @ZoMi
Thanks for adding more background on your standing - that helps!!
To your point
Yes, it is possible to pre-define your quote code to create a dynamic quote template which incorporates associated contacts based on your pre-defined labels
Make use of Hubspot’s templating language or your quote editor’s functionality to dynamically populate the placeholders with contact information
Help guide on Quote - Create and share quotes (hubspot.com)
Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards
Hi Hamashakar,
I managed to put together a workflow code snippet to fetch all deal associated contacts and their association label. Here is an example… the resoult.
Social_security_number + Firstname + Lastname + ContactType(thel abel)
What remains is now to create a dynamical quote template module.js and addapt it to use as you sugested some identefiers for placing the information in the quote. In my case this identifyers is the association label (ContactType).
Hi again,
I’m new at this and not a developer, but I have the will to learn, and to do so, I need some help and guidance.
As described before, I would like to get the associated contacts’ (firstname, lastname) and their association label (in my case, e.g., “Guarantor_1,” “Guarantor_2,” “Guarantor_3”).
This is how far I’ve progressed, but I’m not getting what I need.
Please, someone provide a simple example of how to achieve this. I’m confident that if I just get an example for at least one, then I’ll manage myself.
Here is my code:
const hubspot = require(“@hubspot/api-client”);
const dealId = “Register-ID”; // This is the deal Record-ID
exports.main = async (event, callback) => {
const hubspotClient = new hubspot.Client({ apiKey: process.env.TOKEN });
try {
// Fetch associated contacts for the deal
const apiResponse = await hubspotClient.apiRequest({
method: “GET”,
path: `/crm/v4/objects/deals/${dealId}/associations/contacts`,
headers: {
accept: “application/json”,
“content-type”: “application/json”,
},
});
// Process the contacts data from apiResponse
const associatedContacts = apiResponse.body.results;
const contactNames = associatedContacts.map(contact => `${contact.properties.firstname} ${contact.properties.lastname}`);
// Callback with specific values (dealname and associated contact names)
callback({
outputFields: {
associatedContacts: contactNames.join(", "), // Concatenate contact names
},
});
} catch (err) {
console.log(“ERROR:”, err);
}
};