Skip to content

Pending Information

Offline stores can expose information about whether or not an entity has any pending change requests in the request queue.

Entities

hasPendingChanges is different from isLocal based on whether or not the change requests have been sent to the back end. An entity that has changes in the request queue that have not been sent will be both local and pending. When the changes in the request queue have been sent to the back end but the results have not been received by a download operation, the entity will be local but NOT pending. The following code fragment demonstrates how to query for all products with a filter to retrieve only products that have pending changes:

DataQuery query = new DataQuery().filter(OfflineODataQueryFunction.hasPendingChanges());
List<Product> products = demoService.getProducts(query);
Product product = products.get(0);

// This shows how to check whether an entity has pending changes
if (product.hasPendingChanges()) {
    // Process the pending changes
    ...
}
var query = DataQuery().filter(OfflineODataQueryFunction.hasPendingChanges())
var products = demoService.getProducts(query)
var product = products[0]

// This shows how to check whether an entity has pending changes
if (product.hasPendingChanges()) {
    // Process the pending changes
    ...
}
let query = DataQuery().filter(OfflineQueryFunction.hasPendingChanges())
let products = try demoService.fetchProducts(matching: query)

// Assuming there is at least one product that has pending changes
let product = products.first!

// This shows how to check whether an entity has pending changes
if product.hasPendingChanges {
    // Handle the pending changes
    ...
}

Last update: April 26, 2024