This question runs in a pre-configured Salesforce environment - no personal connection required.
Write a method that queries and returns account names from a specific country with annual revenue greater than a specified threshold. The method should accept two parameters: a country name and a minimum revenue amount. Return the account names as a list of strings sorted alphabetically.
Use SOQL to filter accounts based on both BillingCountry and AnnualRevenue fields. Only include accounts where the annual revenue exceeds the minimum threshold. Sort the results by account name in ascending order.
Method Signature
public static List<String> getAccountsByCountryRevenue(String country, Decimal minRevenue)
Examples
Example 1:
Input: country = 'USA', minRevenue = 20000000
Output: ['Acme Corporation', 'Global Tech Solutions']
Explanation: Returns USA accounts with annual revenue greater than 20 million, sorted alphabetically by name
Example 2:
Input: country = 'Germany', minRevenue = 10000000
Output: ['Berlin Manufacturing', 'Deutsche Industries']
Explanation: Returns German accounts with revenue exceeding 10 million, sorted by name
Example 3:
Input: country = 'Canada', minRevenue = 50000000
Output: []
Explanation: No Canadian accounts meet the high revenue threshold, so an empty list is returned
Example 4:
Input: country = null, minRevenue = 10000000
Output: []
Explanation: When country is null, return an empty list
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