User Story
As a sales representative at ABC Corporation, I want to search for Accounts and Contacts that meet specific criteria so that I can target my sales efforts more effectively. Using the "Advanced Account and Contact Search" feature, I can retrieve a list of Accounts and their associated Contacts that meet a variety of conditions, such as being located in California or New York, having multiple Contacts in San Francisco, and having closed-won Opportunities totaling more than $1 million. By specifying additional search criteria, such as email addresses and last activity dates, I can further refine my search and identify the most promising prospects for my sales efforts.
SOQL
SELECT Id, Name, (SELECT Id, FirstName, LastName, Email FROM Contacts WHERE MailingState = 'CA' AND Email LIKE '%@gmail.com%' AND LastActivityDate > 2023-03-01 ORDER BY LastName ASC NULLS FIRST LIMIT 5), (SELECT Id, Name, Amount FROM Opportunities WHERE Amount > 100000 ORDER BY Amount DESC NULLS LAST LIMIT 3)
FROM Account
WHERE BillingCountry = 'United States' AND (ShippingState = 'CA' OR ShippingState = 'NY') AND (SELECT COUNT() FROM Contacts WHERE MailingCity = 'San Francisco') > 2 AND (SELECT SUM(Amount) FROM Opportunities WHERE StageName = 'Closed Won') > 1000000
Video
Video does not exists.