Edits history of script submission #22323 for ' Query More (salesforce)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Query More
     * Fetch the next page of a SOQL result set using the nextRecordsUrl returned by Execute SOQL Query.
     */
    export async function main(auth: RT.Salesforce, next_records_url: string) {
      const url = new URL(`${auth.instance_url}${next_records_url}`)
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: `Bearer ${auth.token}`,
          Accept: "application/json",
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 9 days ago