This question runs in a pre-configured Salesforce environment - no personal connection required.
Write a method that uses SOQL to find all Contact records whose email address belongs to a specific domain. The method should take a domain parameter (e.g., 'cloudcodeacademy.com') and return a List of Contact names (FirstName + LastName) sorted alphabetically.
This challenge tests your ability to work with string pattern matching in SOQL using the LIKE operator and handle proper field concatenation.
Examples
Input: domain = 'cloudcodeacademy.com'
Output: ['Michael Johnson', 'Nina Petrov', 'Sarah Davis']
Explanation: Returns contacts whose email ends with '@cloudcodeacademy.com', sorted by name
Input: domain = 'techflow.com'
Output: ['Emily Martinez', 'Grace Kim', 'Robert Chen']
Explanation: Returns contacts whose email ends with '@techflow.com', sorted by name
Input: domain = 'nonexistent.com'
Output: []
Explanation: Returns empty list when no contacts have emails from that domain
Apex Code Editor
Welcome to Lightning Challenge!
Create an Account
Sign up to track your progress, earn points, and compete with others. Your solutions will be saved automatically.
Create accountHow It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Note
You can test your code by connecting to Salesforce, but to save your progress and earn points, you'll need to create an account. Your solutions and achievements will be tracked automatically once you're logged in.