---
schema_version: "1"
id: 2ee6612089e5939e297f38af35ab33e50a20b5ae7c37e370c1db0d4140c1e952
title: Process Data 360 Data Model Objects with Apex Cursors (Beta)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/release-notes/264-0-0/rn_apex_cursors_dmo.md
canonical_url: https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_cursors_dmo.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 60262d28198fadf0addf7324ee3afdcd554e32bb431cf0b19bf9d1ac7c5ef8cc
description: Use Apex cursors with Data 360 data model objects (DMOs) to process large SOQL query result sets in manageable chunks. Create a cursor with Database.getCursor(), retrieve records with Cursor.fetch(), and get the result set size with Cursor.getNumRecords(). Monitor Data 360 cursor rows, cursor instances, and Data 360 Flex Credit limits as you process DMO records.
products:
  - Cross Cloud
release: "264"
---
# Process Data 360 Data Model Objects with Apex Cursors (Beta)

Use Apex cursors with Data 360 data model objects (DMOs) to process large SOQL query result sets in manageable chunks. Create a cursor with `Database.getCursor()`, retrieve records with `Cursor.fetch()`, and get the result set size with `Cursor.getNumRecords()`. Monitor Data 360 cursor rows, cursor instances, and Data 360 Flex Credit limits as you process DMO records.

**Where:** This feature is available in API version 68.0 and later. This feature is available in Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions.

![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-release-notes-salesforce_release_notes-264-0-0-production-enus/550ba85b-db1a-4608-9cd4-9a65ec96e1fa/images/icon_important.png)

Important Apex Cursors for Data 360 Data Model Objects is a pilot or beta service that is subject to the Beta Services Terms at [Agreements - Salesforce.com](https://www.salesforce.com/company/legal/agreements/) or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the [Product Terms Directory](https://ptd.salesforce.com/). Use of this pilot or beta service is at the Customer's sole discretion.

**How:** In Apex, call `Database.getCursor()` with a SOQL query against a DMO. Use `Cursor.fetch()` to retrieve records in chunks and `Cursor.getNumRecords()` to get the number of records in the result set. Apex cursors for Data 360 DMOs expire 24 hours after creation, and `System.InvalidQueryLocatorException` is thrown if it expires before processing completes.

For example, this code creates a cursor for the `Individual__dlm` DMO.

```java
public with sharing class DataChunkProcessor implements Queueable {
    private Database.Cursor cursor;
    private Integer position;

    public DataChunkProcessor() {
        // Initialize cursor with DC SOQL
        this.cursor = Database.getCursor('SELECT Name__c, Email__c FROM Individual__dlm');
        this.position = 0;
    }

    public void execute(QueueableContext context) {
        // Fetch a chunk of 200 records without hitting SOQL query row limits or heap limits
        List<Individual__dlm> records = cursor.fetch(position, 200);

        // Process records
        for (Individual__dlm rec : records) {
            // Business logic
        }

        this.position += records.size();

        // Chain the next job if more records are left
        if (this.position < cursor.getNumRecords()) {
            System.enqueueJob(this);
        }
    }
}
```

Use the `Limits` class to get Data 360 cursor instance and Data 360 cursor row limits. SOQL queries against DMOs consume Data Services credits from your Data 360 subscription. See [Data Cloud License Billing and Limits](https://help.salesforce.com/s/articleView?id=data.c360_a_data_cloud_license.htm&type=5&language=en_US).

#### See Also

- [_Apex Developer Guide_: Apex Cursors](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_cursors.htm)
- [_Apex Reference Guide_: System.Limits Class](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_limits.htm#apex_System_Limits_getDataCloudCursors)