CMS Development

DDraghici
Member | Partner
Member | Partner

CRM Associations Deals, display Owner Name instead of ID

SOLVE

Hi everyone!

 

I'm trying to pull deals associated to a company and display them to the users that are a part of the company.

 

I'm doing this with crm_associations, however I need to display the deal's owner name instead of the owner id, is there a workaround to do so?

 

I'm searching for the associations based on the user's company's ID.

 

This is what I have so far:

 

{% set company_deals = crm_associations(request.contact.company.hs_object_id, 'HUBSPOT_DEFINED', 6, '&properties=hubspot_owner_id,deal_status, firstname, lastname', 'dealname, amount, deal_currency_code, deal_status, dealstage, hubspot_owner_id, firstname, lastname') %}

{% for deal in company_deals.results %}
<p>
Owner: {{ deal.hubspot_owner_id }}
</p>
{% endfor %}

 

 

But I'm getting the Deal's Owner ID - I know that is intended to get returned, is there any way to make it show the owner's name?

 

I know that for contacts you can use the following snippet and you're getting the first name, is there something similar for this?

 

{{ request_contact.contact.hubspot_owner_id.firstname }}

 

 

Or is there a better solution/workaround for this?

 

Thanks in advance!

1 Accepted solution
JBeatty
Solution
Guide | Diamond Partner
Guide | Diamond Partner

CRM Associations Deals, display Owner Name instead of ID

SOLVE

Hi @DDraghici,

 

I have had to do this in the past for a client and here is the work around I came up with. First on your deal you can create a new property, something like "Deal Owner Full Name". Then create a workflow, trigger off of deal owner is known(With reenrolment turned on). Then the only action in the workflow should be a set property action. Set the property "Deal Owner Full Name", then inside of the action where you write what you want it to be set to you can copy and paste the following:

 

{{ deal.hubspot_owner_id.fullname }}

 

If done correctly it will look like this:

JBeatty_0-1664313174833.png

And you can confirm that it works correctly becuase when you save the action it should flash to this just for a moment:

JBeatty_1-1664313219999.png

And then go back to this:

JBeatty_2-1664313230273.png

You could do firstname or lastname or email instead as well. Then you can just have this property be one of the properties that is returned by the crm_associations function and use this in your HUBL.

 

Best,

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

View solution in original post

7 Replies 7
JBeatty
Solution
Guide | Diamond Partner
Guide | Diamond Partner

CRM Associations Deals, display Owner Name instead of ID

SOLVE

Hi @DDraghici,

 

I have had to do this in the past for a client and here is the work around I came up with. First on your deal you can create a new property, something like "Deal Owner Full Name". Then create a workflow, trigger off of deal owner is known(With reenrolment turned on). Then the only action in the workflow should be a set property action. Set the property "Deal Owner Full Name", then inside of the action where you write what you want it to be set to you can copy and paste the following:

 

{{ deal.hubspot_owner_id.fullname }}

 

If done correctly it will look like this:

JBeatty_0-1664313174833.png

And you can confirm that it works correctly becuase when you save the action it should flash to this just for a moment:

JBeatty_1-1664313219999.png

And then go back to this:

JBeatty_2-1664313230273.png

You could do firstname or lastname or email instead as well. Then you can just have this property be one of the properties that is returned by the crm_associations function and use this in your HUBL.

 

Best,

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

mslarson
Participant | Platinum Partner
Participant | Platinum Partner

CRM Associations Deals, display Owner Name instead of ID

SOLVE

Beautiful solution. Thank you.

DDraghici
Member | Partner
Member | Partner

CRM Associations Deals, display Owner Name instead of ID

SOLVE

Hi @JBeatty,

Thanks for this possible solution, just a few questions:

 

1. There are 1000+ active deals, will that workflow update the new property for all of the existing deals?
2. Will there be a notification/email sent out to the deals owners?

 

I was thinking of something similar but I didn't know the answers to these 2 questions + I thought/hoped I'll be able to pull this off by using the existing/default properties.

 

Thanks!

JBeatty
Guide | Diamond Partner
Guide | Diamond Partner

CRM Associations Deals, display Owner Name instead of ID

SOLVE

Hi @DDraghici,

 

1. Make sure you have it set to just deal owner is known with reenrollment on, then when you turn on the workflow make sure you select "Yes enroll existting deals that meet this criteria"

2. Nope, since this is just updating a single line text property and not changing any HubSpot owner properties there wont be any notifications from that.

 

Best,

 

Best

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

nikodev
Top Contributor | Elite Partner
Top Contributor | Elite Partner

CRM Associations Deals, display Owner Name instead of ID

SOLVE

Hey @DDraghici,

Owners aren't technically objects in hubspot, but I'm wondering if you can use that deal.hubspot_owner_id in conjunction with the crm_object function to retrieve the additional name properties you're looking for? If not, I'm curious to hear the right answer on this as well. I spend a lot more time working with the APIs than I do on the client side with hubl.

A8 Labs

Jaycee_Lewis
Community Manager
Community Manager

CRM Associations Deals, display Owner Name instead of ID

SOLVE

I had a similar thought @nikodev. And I hoped some smart human would have an approach coming at it from the other direction. Thanks, @JBeatty 🙌

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

Jaycee_Lewis
Community Manager
Community Manager

CRM Associations Deals, display Owner Name instead of ID

SOLVE

Hi @DDraghici 👋 Welcome to the community! Hey @Jnix284 @piersg, do you have any thoughts on how to approach the project @DDraghici is working on?

 

Thank you very much for taking a look! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot