May 2025 Apex Insider Newsletter
Hello there, all budding Salesforce Devs! Welcome to the May 2025 edition of Apex Insider.
Advantages of Queueable Apex over Future Methods
Asynchronous (async) processing is essential for developing robust Salesforce applications that handle complex workloads efficiently. While Salesforce offers more than one asynchronous solution, including the Batch interface and @future
methods, Queueable Apex is often the best solution for developers seeking better control and flexibility over asynchronous execution.
If you’re a developer looking to do asynchronous processing and you’re not working with huge record volumes, consider using the Queueable interface. The Queueable interface (System.Queueable
) allows you to create sophisticated asynchronous jobs with these enhanced features not available in @future
methods:
1. Chainable Execution
One of the most significant advantages of Queueable Apex is the ability to chain jobs. Unlike @future
methods, which cannot call other @future
methods, Queueable jobs can enqueue another Queueable job from within their execution:
Note: If you’re working in a Developer org, you can only chain to a depth of 5.
2. Support for Complex Data Types
@future
methods are limited to primitive data types or collections of primitives. Queueable Apex, however, supports complex data structures, sObjects, and custom Apex objects:
3. Provided Job ID and Monitoring Capability
@future
methods are sent off into the ether and cannot be traced or monitored once executed (”fire and forget”). By contrast, Queueable Apex returns a job ID when enqueued, allowing for improved monitoring and status tracking:
4. Execution-Delay Control
Unlike @future
methods, which must be executed immediately when enqueued, Queueable jobs can be delayed using the System.enqueueJob(queueable, delay)
method:
Working with rate-limited external systems that could be overloaded by rapid callouts
- Polling for results such that executing methods too quickly would waste daily asynchronous Apex limits
- Creating processing pipelines with specific timing requirements
- Implementing retry mechanisms with deliberate delays
Note: When setting the delay to 0 on chained queueable jobs, implement a mechanism to slow down or halt the job if necessary to avoid rapidly reaching the daily async Apex limit.
While @future
methods might still have their place in simpler asynchronous scenarios, Queueable Apex provides superior capabilities for complex, enterprise-grade applications. By offering features like job chaining, complex data-type support, and improved transaction control, queueables are the clear winner when building maintainable asynchronous code in Salesforce.
The next time you need to implement asynchronous processing in your Salesforce org, consider Queueable Apex as your first choice - your future self (and your users) will thank you.
Call to Action!
It’s time for you to join the daily Apex coding contest at Lightning Challenges for the chance to win a free Salesforce certification voucher! Here are the relevant details:
- The next contest starts May 1st and runs till May 15th, 2025. Warren Walters will announce the winners on May 16.
- The #1 ranked player on our #CodeEveryDay leaderboard by 11:59 PM EDT May 15th receives a voucher worth up to $400 USD to use for any Salesforce certificate exam, including Platform Developer I.
- Additional prizes available for other top leaderboard positions. Track your position and compete for prizes!
- Points are only calculated for questions created and completed during the contest period.
- If you previously won, you are not eligible to win the certification voucher again.
Cirra AI: Transforming Salesforce Configuration
|
Cirra AI is an exciting new tool that uses artificial intelligence (AI) to automate Salesforce configuration tasks through natural-language commands.
Testing the Tool
In Warren’s testing, Cirra AI demonstrated the ability to complete some basic, repetitive configuration tasks:
- Created custom fields on the Lead object (grade-level picklist, Subject field, session type)
- Updated page layouts to include new fields without manual intervention
- Converted a JSON API structure into appropriate Salesforce object fields
Unfortunately, Cirra AI also displayed some limitations and shortfalls:
- Attempted to create an unsupported master-detail relationship to Lead
- Displayed some UI limitations when editing generated code
- Showed processing delays during complex implementations
Conclusions
In Warren’s estimation, Cirra AI shows tremendous potential for boosting productivity. Its key strengths include the following:
- Intuitive natural language interface
- Strong understanding of Salesforce metadata
- Contextual awareness of existing configurations
- Significant time savings for common tasks
On the other hand, Cirra AI could improve in these areas:
- Better error handling and recovery
- Refined UI for reviewing code
- More robust handling of complex scenarios
Overall, Cirra AI represents an exciting step toward AI-assisted development that eliminates repetitive tasks while allowing Salesforce professionals to focus on higher-value work.
Cloud Coder Wins in April
- Buyan Suvan passed the Capstone project!
- Frank passed the Platform Developer I exam!
- John George landed his first Salesforce Developer role!
Responses