SalesforceTrailhead
  • Today
© 2026 Salesforce, Inc. All rights reserved. Privacy Terms of Use Trust Accessibility Cookie Preferences
Asynchronous Apex

Use Future Methods

+500 Points~40 minsHands-On Challenge
Asynchronous ApexUse Future Methods

Org:Mindful Goat Playground

Topics

  • Concepts
  • Hands-On Challenge

Looking for help?

Explore Help ResourcesShare Your Feedback
Learning Objectives

After completing this unit, you'll be able to:

  • Write a future method.
  • Test a future method.

Concepts

A future method is a static void method annotated @future. Add (callout=true) to make callouts. Parameters must be primitives or collections of primitives.

Hands-On Challenge

  1. Create a class AccountProcessor with a future method countContacts(List<Id> accountIds).
  2. Set Number_Of_Contacts__c on each account to its contact count.
  3. Write a test class with 100% coverage.
Check ChallengeDemo check
Previous UnitAsynchronous Processing BasicsNext Unit Use Batch Apex