I see the note Asyc SOQL is scheduled for retirement in all Salesforce orgs as of Spring ’22
on SOQL and SOSL Reference.
Is this a glitch in the documentation?
I see the note Asyc SOQL is scheduled for retirement in all Salesforce orgs as of Spring ’22
on SOQL and SOSL Reference.
Is this a glitch in the documentation?
(your friendly neighborhood tech writer here) we wanted to give customers as much warning as possible, and that meant squeaking this into our publishing schedule - which resulted in typos. That's my fault. It is spring '23. And it is Async SOQL.
It'll be fixed the next time we publish, but that may take a bit.
There's a release note coming that'll have multiple examples for how to use alternatives. We hope you reach out if you have questions so this is a smooth transition.
Looking internally - I believe it should say Spring '23
. I've notified the doc writer in hopes to clarify that.
Edit: And there is now a help doc about the retirement with more information showing examples using batch Apex and Builk API. Below is taken from it
Example URI
/services/data/vXX.X/jobs/query
Example Post Request
{
"operation": "query",
"query": "SELECT ParentId, FieldHistoryType, Field, Id, NewValue, OldValueFROM FieldHistoryArchive WHERE FieldHistoryType = ‘Account’ AND CreatedDate > LAST_MONTH"
}
Batch Apex
public class QueryBigObjectAndContact implements Database.Batchable<sObject> {
private String key;
public QueryBigObjectAndContact(String keyParam) {
key = keyParam
}
public Iterable<SObject> start(Database.BatchableContext BC) {
return [SELECT Big_Object_Field__c, Account__c FROM Big_Object__b WHERE Big_Object_Primary_Key__c > key LIMIT 50000]
}
public void execute(Database.BatchableContext bc, List<Big_Object__b> bos){
// process the batch of Big Objects and associate them to Accounts
Map<Id, Big_Object__b> accountIdToBigObjectMap = new Map<Id, Big_Object__b>();
for (Big_Object__b bigObject : bos) {
accountIdToBigObjectMap.put(bigObject.Account__c, bigObject);
key = bigObject.Big_Object_Primary_Key__c
}
Map<Id, Account> = new Map<Id, Account>(
[SELECT Id, Name, ... FROM Account WHERE Id IN :accountIdToBigObjectMap.keySet()]
);
for (Id accountId : accountMap.keySet()) {
Big_Object__b bigObject = accountIdToBigObjectMap.get(accountId);
Account account = accountMap.get(accountId);
// perform any actions that integrate the Big Object and Account
}
}
public void finish(Database.BatchableContext bc){
// Daisy chain additional calls using the primary key of the Big Object to get around the 50k governor limit
QueryBigObjectAndContact nextBatch = new QueryBigObjectAndContact(key);
Database.executeBatch(nextBatch);
}
}