10

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?

2 Answers 2

6

(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.

3
  • 2
    Welcome to the site - pelase do stick around, always handy to have accurate input from the inside!
    – Matt Lacey
    Commented Nov 30, 2022 at 15:23
  • 1
    Awesome, thanks for the feedback and yes, please stick around. It is always great to learn with you guys! Be welcome. Commented Nov 30, 2022 at 15:32
  • 1
    @Tyrin, what does salesforce recommend as the alternative to using async soql? Commented Jan 4, 2023 at 18:25
6

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);
    }
}
4
  • 1
    Interesting, Kris. I'm curious to see what will be the alternative to query Big Objects. Commented Nov 18, 2022 at 22:52
  • 2
    It's also misspelled as "asyc" Commented Nov 18, 2022 at 23:50
  • 1
    So why? how do you use Big Objects without this?
    – JodieM
    Commented Nov 20, 2022 at 6:07
  • 4
    There's going to be a doc with this info - but, it appears to show using Bulk API and batch apex to replace async queries. Commented Nov 20, 2022 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .