What is Async SOQL and when to use it?
What is Async SOQL?
Async SOQL is a method to run SOQL queries.
When to use Async SOQL?
When you have to query from a large amount of data( Big Objects containing more than 1 million records) and then copy that data to another custom or standard object to examine the data set easily.
How to use Async SOQL?
You need to create a POST request with the query as the body.
Example of the POST request:
URI: yourSalesforceInstance/services/data/v38.0/async-queries/
Body:
{
"query": "SELECT field1__c, field2__c FROM CustomObject1__c WHERE probability >90",
"targetObject": "CustomObject2__c",
"targetFieldMap": {"field1__c":"field1__c",
"field2__c":"field2__c"
}
}
Explanation:
- The above POST request will be sent to the org.
- The SOQL query will retrieve the records and then create a copy of the records in the target object according to the field mappings mentioned in the body.
No comments:
Post a Comment