CMS Development

Antoine_AR
Member

Get more than 100 custom objects in design manager

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 ? 

0 Upvotes
Teun
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

Get more than 100 custom objects in design manager

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.



Did my answer solve your issue? Help the community by marking it as the solution.
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Get more than 100 custom objects in design manager

@Teun @I could be wrong but I think the team implemented the same restriction on graphql a few weeks ago 🙃

@Antoine_AR 

 

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. 

Teun
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

Get more than 100 custom objects in design manager

Aw that's a bummer! In that case, a loop would be the best solution!



Did my answer solve your issue? Help the community by marking it as the solution.
TiphaineCuisset
Community Manager
Community Manager

Get more than 100 custom objects in design manager

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 !