O'Reilly logo

Development with the Force.com Platform: Building Business Applications in the Cloud, Third Edition by Jason Ouellette

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exporting Records

The Bulk API can also be used to query Force.com to export large numbers of records in a CSV or XML file format. First a bulk export job is created; then a batch is added to the job containing a SOQL statement. The SOQL cannot contain relationship fields; nested queries; or the aggregate functions COUNT, ROLLUP, SUM, or GROUP BY CUBE. Next, the status of the job is checked, and, finally, the results retrieved in files, each up to 1GB in size.

To begin, create a bulk export job using the request in Listing 11.9.

Listing 11.9 Creating the Bulk Export Job

echo '<?xml version="1.0" encoding="UTF-8"?>  <jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">  <operation>query</operation>  <object>Project__c</object> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required