Import fields' values

SOLVE
Highlighted
Occasional Contributor

Hello.
I would like to know if there is any way to import values into the fields that I use in custom modules for my landing page

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Moderator

Hi, @rainism.

 

Unlike contact properties, it is not possible to reference product property values on a web page with HubL variables.

 

If a website visitor's identity is associated with a known contact record, HubL can retrieve the corresponding property values. Products, however, cannot be associated with visitor identities or contact records (only deals via line items), and cannot be referenced on their own.

 

You could store product information in custom contact properties and use HubL variables to surface this data, but every visitor identity would need to be associated with a contact with a known value in order to see it. At that point, hard coding may be a better option.

 

Finally, I want to mention HubDB again, which is by far the best tool if you wish to curate a listing of products in one place and have the data populate across your website. Check out the technical documentation here.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
6 Replies 6
HubSpot Moderator

Welcome, @rainism.

 

Happy to help.

 

Could you clarify the type of "field" you are using?

 

If you are storing values in custom contact properties and using HubL "personalization" tokens to render their values in your custom modules (e.g. {{ contact.firstname }}), you can absolutely set and update values via import.

Isaac Takushi

HubSpot Developer Support
Occasional Contributor

I'm mostly using image and text fields, and I guess I can't really create an image field via Properties.

I think I could use fields for Product but I have a question.

I'm gonna use my custom module in another pages as well, so I guess if I change values of the fields via import, it will update the values for all the pages. Is there any workaround?

I'd probably make another custom module but there gonna be a lot of pages so I don't want to update the values manually.

Reply
0 Upvotes
Occasional Contributor

No, just realized there's no image field for Product

Reply
0 Upvotes
HubSpot Moderator

Hi, @rainism.

 

While there are no "image" fields, most users upload an image link to a single-line text field and then place the token in an img tag's src attribute. For example:

 

 

<img src="{{ contact.image_1 }}" alt="Image 1" height="50" width="50"> 

The above approach only works with custom contact properties, however. It will not work for custom product properties.

 

If you need to display product images and descriptions, you might want to consider HubDB (keep in mind this requires the HubSpot CMS.) Check out the technical documentation here.

 

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Occasional Contributor

Is it possible to show products' fields in the custom module? Like {{product.field1}}?

Reply
0 Upvotes
HubSpot Moderator

Hi, @rainism.

 

Unlike contact properties, it is not possible to reference product property values on a web page with HubL variables.

 

If a website visitor's identity is associated with a known contact record, HubL can retrieve the corresponding property values. Products, however, cannot be associated with visitor identities or contact records (only deals via line items), and cannot be referenced on their own.

 

You could store product information in custom contact properties and use HubL variables to surface this data, but every visitor identity would need to be associated with a contact with a known value in order to see it. At that point, hard coding may be a better option.

 

Finally, I want to mention HubDB again, which is by far the best tool if you wish to curate a listing of products in one place and have the data populate across your website. Check out the technical documentation here.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes