Skip to content

Instantly share code, notes, and snippets.

@amitastreait
Created May 5, 2023 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitastreait/f0c626e18d570b950501710a864d7071 to your computer and use it in GitHub Desktop.
Save amitastreait/f0c626e18d570b950501710a864d7071 to your computer and use it in GitHub Desktop.
SOQL Use case for practice in salesforce.
1. What is SOQL in Salesforce?
2. What is the Structure of the SOQL Query in Salesforce?
3. List All the Contact Records
4. List All the Contact Records where the Email is not blank
5. List All the Contact Records Where the Email is Blank
6. List All the Contact Records Where the Title contains the developer
7. List All the Contact Records Where the Title Starts with the Manager
8. List All the Opportunity Where the Amount is more than 29000
9. List All the Opportunity count state wise
10. List All the Opportunity Amount Stage Wise
11. List All the Open & Closed Opportunities
12. List All the Contact Records with Account Name, Rating, and Industry
13. Query on the Account object and also query all the related Contact, Case, Order, and Opportunities
14. Create 3 Custom Objects
1. An invoice that is related to the Account
2. An Invoice Line Item object that is related to the Invoice
3. A payment that is related to the Account
4. Now Query on Invoice Records to Query the Related Account Information and Also all the related Invoice Line Items
5. Note: - Please create the required records for these objects
15. Query All the Contact Record that does not have any Account Related To
16. Query All the Contact Records that are related to Account Record
17. Query All the Account Record that does not have any contact
18. Query All the Account Record that does have min one Contact Record
19. Query the Invoice Record, its Related Account, and Account Related Parent Account Record
20. Query the Invoice Line Item Record, its Related Invoice, Invoice Related Account, and Account Related Parent Account Record
21. Write a SOQL Query to Show the MAX amount from the opportunity
22. Write a SOQL Query to identify the duplicate records by Name & Email
23. Write a SOQL Query to display the count of Accounts for every Industry
24. Create an Apex Class and name is SOQLDemo
1. Create a method and name it searchAccount that accepts a single parameter as the account name or portion of the account. Make a SOQL Query to get all the accounts whose names are the matching name as parameters and put a debug log.
2. Create a method polymorphicQueryDemo and make a SOQL query to get the Event Information that is related to Account, Contact, Opportunity, and Case. See more for the query
1. When What is Account SELECT Id, Name, Phone, Industry
2. When What is Opportunity SELECT Id, Name, Amount
3. When What is Case SELECT Id, CaseNumber, Subject, Status
4. When What is Contact SELECT Id, Name, Email, Phone
3. create a method soqlForLoopDemo and do the query on Account, Contact, and Opportunity using SOQL For Loop
4. Create a method that accepts the List of Industries and the keyword. Inside the method make the SOQL Query that filters the account based on Industry and the name based on the parameter.
1. Note: - Name should be having “Like” the filter on the Account Name field
5. Create a method and have the below query inside that method
1. Query All the Contact Record that does not have any Account Related To
2. Query All the Contact Records that are related to Account Record
3. Query All the Account Record that does not have any contact
4. Query All the Account Record that does have min one Contact Record
5. Query the Invoice Record, its Related Account, and Account Related Parent Account Record
6. Query the Invoice Line Item Record, its Related Invoice, Invoice Related Account, and Account Related Parent Account Record
7. Write a SOQL Query to Show the MAX amount from the opportunity
8. Write a SOQL Query to identify the duplicate records by Name & Email
9. Write a SOQL Query to display the count of Accounts for every Industry
@govindkr6498
Copy link

please drop also answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment