We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Jan 26, 2022 4:00 PM
Hello everyone !
I'm currently trying to make a script which looks in a list of more than 100 objects in javascript.
For now, the only solution I found is to use this :
{% set events = crm_objects("product", "hs_folder_id=5167212&limit=100", "name, hs_url, description, id, price, hs_images")%}
{% for event in events.results %}
<div class="mission-data" data-name="{{ event.name }}" data-price="{{ event.price}}" data-hs_images="{{ event.hs_images }}" data-hs_url="{{ event.hs_url }}" data-description="{{ event.description }}" >
{{ event.name }}
{{ event.price}}
{{ event.hs_images }}
{{ event.hs_url }}
{{ event.description }}
</div>
{%endfor %}
This method can get only 10 products. But you can add "limit=100" to expand to one hundred. But you can't go further.
In javascript, I retrieve the data from data attribute.
So, do you have a solution to get more products with this method ? Or is there a better method to get all the products directly in javascript ?
Jan 28, 2022 4:51 AM
Hi @Antoine_AR ,
This sounds like a really cool case for GraphQL.
If you build a query according to the docs you should be able to set the limit to 1000 using the limit argument.
You can either use the data with HubL or get the data with an API request.
Jan 28, 2022 6:23 PM
@Teun @I could be wrong but I think the team implemented the same restriction on graphql a few weeks ago 🙃.
You could build a loop and request you objects inside the loop. This would allow you to call up to 1000 objects. Or use the dynamic page option.
Jan 31, 2022 2:18 AM
Jan 28, 2022 4:37 AM
Hi @Antoine_AR
Thank you for reaching out.
I want to tag some of our experts on this - @Teun @Indra do you have some advice for @Antoine_AR on this?
Thank you!
Best
Tiphaine
![]() | Saviez vous que la Communauté est disponible en français? Rejoignez les discussions francophones en changeant votre langue dans les paramètres ! Did you know that the Community is available in other languages? Join regional conversations by changing your language settings ! |