Salesforce GraphQL API Pagination: Duplicate Records Returned in Second Page Query

Salesforce GraphQL API Pagination: Duplicate Records Returned in Second Page Query


0

salesforce graphql api query accounts, for the second page, using previous endCursor for "after" value, return some duplicate records that already show in the first page. I am using v57 api

First page query:

query accounts {
  uiapi {
    query {
      Account (first:10) {
        edges {
          node {
            Id
            Name {
              value
            }
          }
        }
      }
    }
  }
}

Second page query with cursor:

query accounts {
  uiapi {
    query {
      Account (first:10, after:"djE6OQ==") {
        edges {
          node {
            Id
            Name {
              value
            }
          }
        }
      }
    }
  }
}

It should work like Offset/Limit in SOQL, but more efficient, why the pagination returns duplicate records that already returned in the previous pages? Is there something wrong in my query?

Share

1 Answer
1

Reset to default


0

Unfortunately I don’t have an answer, but wanted to mention that I’ve come across the same issue when using the Salesforce REST API to pull down records from a custom Data Extension. As soon as I call back to get page 2 (or 3, or 4, etc), I start to get a few duplicate records that were returned on the previous page.

I ended up updating the code that makes the calls to the API to handle/remove duplicates. I’m surprised there aren’t more people having this issue.

Share

New contributor

Steve Kent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



Leave a Reply

Your email address will not be published. Required fields are marked *