Copy Contact Association Label to Contact Property
SOLVE
Hello,
I'd like to know if it is possible to get the string of the association label on a Contact that is associated with a deal. Then using that string to copy it over to a Contact property.
I've got the below custom code where I'm able to get the Associated Contact's details however I'm unsure on how to get the Associated Contact's Association Label. I would then like to save that value onto a variable which I will use to copy onto the Contact property.
Copy Contact Association Label to Contact Property
SOLVE
Hey @DEstillero, thank you for posting in our Community!
You can use the HubSpot API to retrieve the association label from a contact associated with a deal, and then update the contact property with that label. For example, start by using the deals.associationsApi.getAll method to get contacts associated with a deal. After you can retrieve the details and association label for each contact using contacts.basicApi.getById and deals.associationsApi.getAssociation. And update the contact property with the retrieved association label using contacts.basicApi.update
Copy Contact Association Label to Contact Property
SOLVE
I think the approach is to use the crm.deals.associationsApi.getAll to get the association IDs then use the crm.deals.associationsApi.getById to get the association lable.
Copy Contact Association Label to Contact Property
SOLVE
Hey @DEstillero, thank you for posting in our Community!
You can use the HubSpot API to retrieve the association label from a contact associated with a deal, and then update the contact property with that label. For example, start by using the deals.associationsApi.getAll method to get contacts associated with a deal. After you can retrieve the details and association label for each contact using contacts.basicApi.getById and deals.associationsApi.getAssociation. And update the contact property with the retrieved association label using contacts.basicApi.update
That make sense to me thank you! However, I'm unfamiliar with using deals.associationsApi.getAssociation, are you able to show me an example of where it is used?