简体   繁体   中英

Salesforce Bulk API job priority

I have a tree of hierarchical data. After tree is built (~300k nodes of 16 different types) I need to push it into Salesforce 16 custom objects in a specific order, parents first then childs, so I have 16 jobs with batches inside.

The problem is that Salesforce handles jobs in parallel and random order so mapping by external ID is failed all the time, childs may be inserted earlier so on.

Any ideas how to resolve it?

Thanks.

You could use Apex Flex Queue to actively manage the order of the queued jobs to control which batch jobs are processed first.

public class AsyncExecutionExample implements Queueable {
    public void execute(QueueableContext context) {
        // Your processing logic here
        // Chain this job to next job by submitting the next job
        System.enqueueJob(new SecondJob());
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM