Best answer

How to implement pagination for triggers

  • 6 January 2023
  • 3 replies
  • 495 views

Badge

Hi,

I want to implement pagination in the trigger so I followed the steps mentioned in the Zapier developer documentation to implement pagination. But I am not getting the second-page results.

I tested this trigger by binding with a dropdown it’s getting second-page data when I click the Load more button in the dropdown.

but it’s not giving the next page result while binding with action. 

please help us with this and how can we achieve this.

 

 

This is our API documentation link: https://developers.freshworks.com/crm/api/#pagination

Thanks in advance.

icon

Best answer by shalgrim 13 January 2023, 21:18

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 6
Badge +8

Hi @Nagamanickam!

I want to make sure I’m understanding what is happening. It sounds like you are saying you have pagination working for this trigger when it is used in a dynamic dropdown, but it is not working for the actual trigger. Is that right?

Can you tell me the details of how you are assessing it is not working for the actual trigger? How are you testing it, and what is the reason you think the trigger should go to a second page?

The pagination in triggers will not automatically request a second page of results. You would need to manually code the app to request extra pages.

If the problem you’re trying to solve is for more new items being created during the polling interval, you might find moving to a webhook trigger or supporting transfer for your users, though that is a beta feature currently.

Thanks!

Badge

Hi @shalgrim 

Yes, your understanding is correct.

I am testing the trigger through publishing zap.

I have attached my code window screenshot below.

 

Here, in my API I have eight contacts and I am setting per page result as two so as per this query I will have 4 pages. But zap getting successful for only 2 contacts, it’s not getting the second page.

Below is a Zap history screenshot:

 

You can see the sidebar task section it’s showing only 2.

I have a question, will the page number change automatically or do we have to change the page using code?

If there is a possibility to change the page number using the code, could you please share a sample code?

 

Thanks in Advance.

Userlevel 6
Badge +8

Okay, I understand. 

Zapier triggers will not automatically go fetch extra pages when they are run. The pagination feature is for dynamic dropdowns, not polling triggers. I recommend a much larger page size.

If you need to request multiple pages during a single poll, then you’ll have to put your requests inside a loop that would terminate whenever the API indicated there were no more pages to retrieve.

Hope that helps! Let us know if you have more questions