DF Process Automation an Logic P2 Flashcards
Cosmic Support is building a complex record-triggered flow to automate its onboarding process. While saving the flow, issues seem to be encountered preventing the flow from being saved. Which feature can be used to help troubleshoot the flow?
A. Debug button
B. Custom Error element
C. Flow Trigger Explore
D. Errors and Warnings Pane
✅ D. Errors and Warnings Pane
The Errors and Warnings pane in Flow Builder provides a summarized list of issues that prevent a flow from being saved or activated. Clicking on the error or warning highlights or opens up the configuration window of the element that is causing the issue.
The Flow Trigger Explorer is used to view related record-triggered flows and their status, order, and trigger types (before-save, after-save, anonymous, and scheduled). The Debug button is used to run the flow in the debug mode. The Custom Error element in Flow Builder is used to deliberately terminate the flow transaction when a required condition, for example, is not met.
Troubleshoot Configuration Issues Systematically with the Errors and Warning Pane
Explanation:
The Errors and Warnings Pane in Flow Builder displays any errors or warnings that prevent the flow from being saved. It provides detailed information about what needs to be fixed, such as missing required fields, invalid configurations, or unsupported logic.
Why not the others?
A. Debug button
The Debug button is used to test and debug a flow after it has been saved. It does not help troubleshoot issues that prevent the flow from being saved.
B. Custom Error element
The Custom Error element is used to handle and display custom error messages during flow execution. It is not used for troubleshooting flow configuration issues.
C. Flow Trigger Explorer
Flow Trigger Explorer is a tool used to view and manage record-triggered flows in an org. It does not provide troubleshooting capabilities for saving flows.
Which Apex trigger context variable returns a map of IDs to the old versions of the sObject records?
A. oldMap
B. updateMap
C. insertMap
D. newMap
A. oldMap
The Trigger.oldMap context variable returns a map collection where the key is the record ID and the value is the old version of the sObject record. This trigger context variable is only available in update and delete triggers.
The Trigger.newMap context variable returns a map collection where the key is the record ID and the value is the new version of the sObject record. An ‘updateMap’ or ‘insertMap’ trigger context variable does not exist.
Considering Apex best practices, which of the following example code snippets is acceptable to be included within a for loop?
A. insert accountRecord;
B. Database.update(accountRecords, false);
C. Opportunity opp = [SELECT Name FROM Opportunity WHERE AccountId = :accountRecord.Id LIMIT 1];
D. if (accountRecord.NumberOfEmployees > 1000) { accountRecord.Priority__c = ‘High’; }
D. if (accountRecord.NumberOfEmployees > 1000) { accountRecord.Priority__c = ‘High’; }
A common mistake is that queries or DML statements are placed inside a for loop. There are governor limits that restrict the allowed number of SOQL queries and DML statements (insert, update, delete, undelete) that can be performed in a single transaction. When these statements are placed inside a for loop, the operation will be invoked once per iteration, making it very easy to exceed the governor limits.
There are two existing workflow field updates, and their ‘Re-evaluate Workflow Rules after Field Change’ options have been enabled. The field update on workflow rule A triggers workflow rule B, and vice-versa. What will be the result of the field updates in this scenario?
A. Recursion does not happen as workflow field updates automatically prevent such occurrence.
B. A recursive loop may happen and exceed the org limit for workflow time triggers per hour.
C. Only the first triggered workflow will run and the second workflow will be prevented from running.
D. The workflow re-evaluation will be automatically prevented from running to avoid a recursion.
B. A recursive loop may happen and exceed the org limit for workflow time triggers per hour.
Workflow rules can create recursive loops. For example, if a field update for Rule1 triggers Rule2, and a field update for Rule2 triggers Rule1, it will cause recursion and may cause the organization to exceed its limit for workflow time triggers per hour.
Workflow field updates do not have a recursion prevention mechanism. Both workflows will be triggered as one causes the other to run. The workflow re-evaluation will be executed.
A developer needs to store the IDs of all the related accounts from a list of contacts. Which collection data types can be used to prevent duplicate IDs?
A. List and Map
B. Set and Map
C. Group and List
D. Set and Enum
B. Set and Map
A set is an unordered collection of elements that do not allow duplicate values. To add an element to a set, the add() method of the Set class is used. This method will add an element only if the element doesn’t exist yet in the collection.
A map, which is an ordered collection of key-value pairs, can also be used since it does not allow duplicate keys. To add an element to a map, the put() method is used. In this case, the key will contain the ID of the record while the value can contain the record itself, for example, or any other value.
A list collection allows storing duplicate values. An ‘Enum’ is an abstract data type used for storing a predefined set of finite values and is not a valid collection data type. A ‘Group’ data type does not exist.
A real estate company uses a custom checkbox field called ‘Is Primary Contact’ on the Contact object to allow users to easily mark a contact record as the primary contact of an account. When the primary contact is deleted, the value of a custom checkbox field called ‘Has Primary Contact’ on the related account should be set to false automatically. While creating an Apex trigger on the Contact object, which trigger event should be used to meet this requirement?
A. After Update
B. Before Delete
C. Before Update
D. After Delete
D. After Delete
Since the requirement is to update the related account after the primary contact has been deleted, the ‘After Delete’ trigger event on the Contact object should be used.
The ‘Before Delete’ trigger event is not recommended as it must be ensured that the contact has been successfully deleted first before updating the related account. The ‘Before Update’ and ‘After Update’ trigger events are fired when a record is updated.
To update another record (the related Account) when a child record (the Contact) is deleted, the recommended pattern is to use an After Delete trigger on the Contact. This is because in an after context, the record has already been removed from the database, and you can safely update a different object (the parent Account in this case).
Therefore, the correct answer is:
D. After Delete.
Why “After Delete” Is Best
Before Delete is primarily used for logic on the record being deleted itself (for example, to prevent deletion by throwing an error). While you could technically update a parent record in a before trigger, Salesforce best practices recommend using after triggers when modifying other objects, as the parent’s data can be cleanly updated after the child record’s final state is determined.
After Delete allows you to access the old record values in Trigger.old or Trigger.oldMap, making it straightforward to identify the parent and then update the parent record (e.g., setting Has_Primary_Contact__c = false).
Hence, to set the parent Account’s Has_Primary_Contact__c to false after its primary Contact has been deleted, choose an After Delete trigger.
Which of the following statements about triggers is true?
A. A developer can specify the version of Apex and API to be used with the trigger.
B. Apex triggers can be used to detect a ‘before undelete’ event.
C. Apex triggers are always active and cannot be turned off.
D. Attachment, ContentDocument, and Note standard object triggers cannot be created in the Salesforce UI.
A. A developer can specify the version of Apex and API to be used with the trigger.
D. Attachment, ContentDocument, and Note standard object triggers cannot be created in the Salesforce UI.
Apex triggers can be activated or deactivated. The ‘Active checkbox’, which is available while editing a trigger, can be used to turn the trigger on or off in a sandbox environment. The deactivated trigger can then be deployed to production to disable the same trigger in production.
In Object Manager, triggers of an object can be found in the Triggers section. The ‘Apex Triggers’ page in Setup can be used to view all triggers of any object. To create Apex triggers for the Attachment, ContentDocument, and Note standard object, the Developer Console, Visual Studio Code, or Code Builder tools can be used.
One may navigate to the version settings to specify the version of Apex and API. Triggers cannot be used to detect a ‘before undelete’ event. Supported trigger events are: before insert, before update, before delete, after insert, after update, after delete, and after undelete.
A custom object has a workflow rule that updates a field when a certain set of criteria is met. A ‘before update’ Apex trigger has also been defined on the object. What will happen when a user updates a record so that it meets the criteria of the workflow rule?
A. The Apex trigger will be fired twice
B. Both will be fired only once
C. An exception will be thrown due to a conflict between the tow
D. The Apex trigger will be fired first, voiding the Workflow Rule due to the order of excecution
A. The Apex trigger will be fired twice
According to the order of execution, ‘before’ triggers are run, ‘after’ triggers are run, and then workflow field updates are processed. If a field is updated due to a workflow rule, ‘before update’ and ‘after update’ triggers are run again one more time, and only one more time. In this case, since the record meets the criteria of the workflow rule, the ‘before update’ trigger will be run again after the workflow field update associated with the rule has been processed.
Triggers and Order of Execution
According to Salesforce’s Order of Execution:
The user’s change is saved to the database (after passing system validations).
All before triggers on the object run.
All after triggers on the object run.
Workflow rules are evaluated: if any are true, their field updates happen.
After a workflow field update, the record goes through the save process again, which includes running before and after triggers a second time.
Since you have a before update trigger and also a Workflow Field Update on the same object, here is what happens step by step when a user updates a record:
The before update trigger fires (1st time).
The record is saved (and the after update trigger would fire, if it exists).
The workflow rule is evaluated; the condition is met, so the field is updated.
Because the field was updated by workflow, the record goes back through “before” and “after” triggers again.
So, your before update trigger fires a 2nd time.
Hence, the Apex trigger (before update) will effectively run twice in this scenario.
Which of the following statements is true regarding future methods?
A. Methods annotated with @future cannot have a void return type.
B. Methods annotated with @future can call another future method.
C. Methods annotated with @future are executed synchronously.
D. Methods annotared with @future are executed asynchronously.
D. Methods annotared with @future are executed asynchronously.
The @future annotation is used to define methods that should be executed asynchronously. Future methods will then be executed only when the org has available resources.
A future method can only return void and does not support other return types. Also, a future method cannot invoke another future method.
A developer has imported 1,000 accounts into Salesforce and wants to verify the records using Apex to ensure that they were created properly. Before the import, there were already 50,000 accounts in the org. Which of the following is a valid consideration related to this use case?
A. Criteria should be added to the SOQL query to filter out unnecessary records.
B. DML statements should be used to process one record at a time only.
C. The ‘with sharing’ keyword should be used to ensure that the query finds the necessary records.
D. A SOQL query should be run inside a loop to retrieve fresh data in each iteration.
A. Criteria should be added to the SOQL query to filter out unnecessary records.
The total number of records that can be retrieved by a SOQL query in a single transaction is limited to 50,000. Criteria should be added to the SOQL query in the Apex code to make the query selective and prevent it from exceeding the limit.
If DML statements were used to process one record at a time, the governor limit for the maximum DML statements that can be issued in a transaction would be hit easily. Moreover, a DML statement would not be required for verifying the records.
Running a SOQL query inside a loop would easily hit the governor limit for the maximum queries that can be executed. Using the ‘with sharing’ keyword would limit access to the records by returning only those records that can be accessed by the current user.
What will happen when the following code is executed?
trigger CaseTrigger on Case (after insert) { List<Case> casesToInsert = new List<Case>(); for (Case parent: Trigger.new) { Case child = new Case(); child.ParentId = parent.Id; child.Subject = parent.Subject + ' Child'; casesToInsert.add(child); } insert casesToInsert; }
Select two ansers.
A. The trigger will be recursively called and result in an infinite loop.
B. The trigger will throw an exception because it is not bulkified.
C. Child cases will be inserted for each Parent case.
D. No parent or child cases will be created.
A. The trigger will be recursively called and result in an infinite loop.
D. What will happen when the following code is executed?
The code consists of an ‘after insert’ trigger which contains a DML statement that inserts records of the same object. The DML statement will recursively invoke the trigger, resulting in an infinite loop, and eventually throw an exception. As a result, no parent or child cases will be created. To prevent trigger recursion, a static boolean variable can be used in the trigger helper class to make the trigger only run once per transaction.
As per the order of execution, when will an email created from a workflow email alert be sent?
A. After all DML operations are committed to the database.
B. After workflow rule execution.
C. Before entitlement rules execution.
D. When all before triggers are executed.
A. After all DML operations are committed to the database.
Execution of post-commit logic, such as sending emails will happen after all DML operations are committed to the database.
Triggers and Order of Execution
Explanation:
In Salesforce, the order of execution determines when different automation processes run. Here’s how it applies to workflow email alerts:
Triggers, validation rules, assignment rules, and workflow rules execute during the transaction.
Workflow rules can trigger email alerts, field updates, task creation, or outbound messages.
Field updates from workflow rules can cause the trigger to re-execute.
Once the entire transaction is committed to the database, email alerts from workflows are sent asynchronously.
Since workflow emails are asynchronous, they are sent only after the transaction completes successfully, meaning after all DML operations are committed to the database.
A developer is creating an Apex trigger on an “Invoice” custom object. What is true about the trigger code below?
trigger LineItemPerInvoice on Invoice\_\_c (before update) { for (Invoice\_\_c invoice : trigger.new) { List<LineItem\_\_c> lineItems = [ SELECT Id, Units_Sold\_\_c FROM LineItem\_\_c WHERE Invoice\_\_c = :invoice.Id ]; // do logic here } }
A. The SOQL statement retrieves all the related line items of a single Invoice record during each loop.
B. The trigger will perform only one SOQL query regardless of the number of invoices to process.
C. An exception will be thrown only if the for-loop performs a DML operation more than 150 times.
D. The trigger demonstrates an example solution that bypasses the governor limit on SOQL queries.
A. The SOQL statement retrieves all the related line items of a single Invoice record during each loop.
The SOQL statement retrieves all the line items related to the invoice that is extracted from the trigger.new context variable during each loop.
A common mistake that developers make is placing queries inside a for loop. The number of SOQL queries allowed in a (synchronous) transaction is up to 100 only. In the given trigger, the SOQL query will be performed once for every record in the trigger.new context variable. Hence, if the trigger processes more than 100 invoices, the governor limit on SOQL queries will be exceeded.
There is a governor limit of 150 DML operations only in a single transaction. However, the governor limit on SOQL queries will be exceeded far before the governor limit on DML operations is reached. Governor limits can never be bypassed. Hence, governor limits should always be in mind when developing in Apex.
When performing an Apex callout after inserting a record in the same transaction, a Salesforce developer encounters the “You have uncommitted work pending” callout exception. If doCallout() represents a method that performs the callout, which of the following options illustrates code that allows the callout to be successfully executed?
A. Savepoint sp = Database.setSavepoint();
insert new Account(name='ACME');
Database.rollback(sp);
doCallout();
B. Savepoint sp = Database.setSavepoint();
insert new Account(name='ACME');
Database.releaseSavepoint(sp);
Database.rollback(sp);
doCallout();
C. Savepoint sp = Database.setSavepoint();
insert new Account(name='ACME');
Database.rollback(sp);
Database.releaseSavepoint(sp);
doCallout();
D. Savepoint sp = Database.setSavepoint();
insert new Account(name='ACME');
Database.releaseSavepoint(sp);
doCallout();
C. Savepoint sp = Database.setSavepoint();
insert new Account(name='ACME');
Database.rollback(sp);
Database.releaseSavepoint(sp);
doCallout();
Salesforce does not allow callouts to be made after DML operations in the same transaction. Doing so will throw the “You have uncommitted work pending” callout exception. To allow the callout to be made, DML operations first need to be rolled back using the Database.rollback() method, and second, the savepoint needs to be explicitly released using the Database.releaseSavepoint() method. Note, however, that performing these exact steps will allow the callout to be executed, but it will undo the DML operations made in the transaction due to the database rollback.
If the callout needs to be made after the DML operation and avoid losing work, the recommended solution is to perform the callout in a separate transaction using asynchronous methods such as a future method.
Make Callouts After Rolling Back DML and Releasing Savepoints
A developer needs to create a trigger that will throw an error whenever the user tries to delete a contact that is not associated with an account. What trigger event can the developer use?
A. Before Undelete
B. After Undelete
C. Before Delete
D. During Delete
C. Before Delete
By using a ‘Before Delete’ trigger, the request can be validated first by determining whether the record can be deleted or not. If the record should not be deleted, the trigger can call the ‘addError’ method to gracefully terminate the request. Note that calling the method in an ‘After Delete’ trigger will roll back the transaction, making this trigger type also a suitable option in this requirement.
The ‘After Undelete’ trigger is invoked when a record is recovered from the Recycle Bin. A ‘Before Undelete’ or ‘During Delete’ trigger type does not exist.
Which of the following options contain valid Apex data types that can be used to declare variables?
A. Number, Enum, String
B. Text, Number, Bolb
C. Currency, Integer, String
D. Blob, ID, Enum
D. Blob, ID, Enum
Blob is one of the primitive data types and can be used to store a collection of binary data stored as a single object. ID is another primitive data type used to store an 18-character record identifier that exists in the org. Enum is an abstract data type that is used to store a value from a set of predefined values.
A ‘Currency’ or ‘Number’ data type does not exist. To store numeric values with decimals, the Decimal or Double data type can be used. To store numeric values with no decimals, the Integer or Long data type can be used. A ‘Text’ data type does not exist. To store text values, the String data type can be used.
A developer is designing a SOQL relationship query. Which of the following statements is true?
A. A relationship between the objects is not required in order to create a join in SOQL.
B. Up to ten levels of child-to-parent relationships can be referenced in a SOQL query.
C. Up to ten levels of parent-to-child relationships can be referenced in a SOQL query.
D. A relationship between the objects is required in order to create a join in SOQL.
D. A relationship between the objects is required in order to create a join in SOQL.
A join in SOQL will return results from two or more standard/custom objects. To create a join, or in order to perform a relationship query, the queried objects should be related to each other via a parent-to-child or child-to-parent relationship.
Up to five (5) levels of relationships are allowed in a parent-to-child relationship query where the root object is considered the 1st level. As for child-to-parent relationship queries, also up to five (5) levels of relationships can be specified in the SOQL statement.
String is one of the primitive data types in Salesforce. Given the following options, what is a valid value that can be assigned to a String variable in Apex?
A. ‘Salesforce’
B. TRUE
C. “Salesforce”
D. 3.141519
C. “Salesforce”
String is any set of characters surrounded by single quotes.
Using double quotes to handle string values causes an error in Apex. String variable declarations or initializations in Apex require single quotes. TRUE represents a boolean value. 3.14159 represents a numeric value.
Which of the following is a valid Apex best practice regarding SOQL queries?
A. Moving queries outside for-loops makes the code run faster and less likely to exceed governor limits.
B. The following use of LIMIT clause should be avoided: for (Account a: [SELECT Id, Name From Account LIMIT 1000]){…}
C. When retrieving related records, multiple queries should always be used instead of querying once to retrieve all the records.
D. Running a query inside a for-loop is acceptable as long as the LIMIT clause is added to the SOQL statement.
A. Moving queries outside for-loops makes the code run faster and less likely to exceed governor limits.
Executing a SOQL query inside a for-loop is not recommended as it will negatively affect performance and easily exceed the governor limit of 100 queries only per transaction. Hence, the number of SOQL queries to run should be minimized. It is a best practice to retrieve all the necessary records in a single query, such as including related records in the same query when necessary. Salesforce recommends using SOQL for-loops to help avoid exceeding governor limits. A SOQL for-loop can process one record at a time using the single sObject format or in batches of 200 records using the sObject list format.
The following shows a SOQL for-loop example that uses the single sObject format, which will retrieve a single record from the query result during each iteration. Note that the execution of the SOQL query defined in the loop will only be counted as a single query against the governor limit. Using a LIMIT clause in the query is acceptable in SOQL for-loops.
for (Account a : [SELECT Id, Name From Account LIMIT 1000]) { … }
What trigger context variable returns true if the current context for the Apex code is a trigger, and not a Visualforce page, a Web service, or an executeanonymous() API call?
A. isUpdate
B. oldMap
C. isUndelete
D. isExecuting
D. isExecuting
The isExecuting context variable returns true if any code inside the trigger context is executing. This means that a particular trigger can be tested whether it is executing or not with the help of this variable.
oldMap is a variable available only in update and delete triggers that contain a map of IDs to the old versions of the records processed by the trigger. The isUndelete and isUpdate trigger context variables return true after undelete and update operations respectively.
What is the correct syntax for writing an Apex trigger?
A. trigger ObjectName on trigger_events (TriggerName) { code_block; }
B. trigger ObjectName on TriggerName (trigger_events) { code_block; }
C. trigger TriggerName on TriggerEvents (ObjectName) { code_block; }
D. trigger TriggerName on ObjectName (trigger_events) { code_block; }
D. trigger TriggerName on ObjectName (trigger_events) { code_block; }
Trigger_events can be a comma-separated list that includes one or more of the following events: before insert, after insert, before update, after update, before delete, after delete, and after undelete.
A developer has created the trigger below to update the description of existing Contract records. How many Contract records will be updated when the developer loads 2,000 Opportunity records?
List<Contract> getContracts = new List<Contract>(); for (Opportunity opp: (List<Opportunity>) Trigger.New) { Contract con = [SELECT Id FROM Contract WHERE Id = :opp.ContractId]; con.Description = 'This is the contract for Opportunity' + opp.Name; getContracts.add(con); } update getContracts;
A. 100
B. 1
C. 2000
D. 0
D. 0
Salesforce limits the total number of synchronous SOQL queries that can be performed in a single transaction to 100 only. As there are 2,000 opportunities to loop through, a LimitException will be thrown on the 101st loop, such as ‘System.LimitException: Too many SOQL queries: 101’. In this case, the entire transaction will be rolled back such that no records will be updated. It is best practice to avoid SOQL queries as well as DML statements inside FOR Loops to prevent transactions from reaching the governor limits.
A Salesforce developer is trying to create a trigger that will set the record type of an Invoice record, prior to insertion, based on the value of the Industry picklist that is selected. What trigger event should the developer use?
A. After Insert
B. After Update
C. Before Insert
D. Before Delete
C. Before Insert
Before triggers are used to update or validate record values before they are saved to the database. In this case, the record type can be set depending on the invoice Industry picklist value prior to insertion.
Using an ‘After Insert’ trigger will make the record read-only, so the record type cannot be set. An ‘After Update’ trigger is used to perform custom logic after an existing record has been updated. A ‘Before Delete’ trigger is used to perform custom logic before a record is deleted.
A Salesforce developer has created a method inside a custom controller that contains the code below to return an error message on a Visualforce page. However, during testing, it was found that the Visualforce page does not display the error on the page. What could be the possible reason?
# custom controller method logic: ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Unable to Sort Last Name'); ApexPages.addMessage(myMsg); Visualforce page: <apex:page controller="ContactsListController"> <apex:form> <apex:pageBlock title="Contacts List" id="contacts_list"> <!-- Contacts List --> <apex:pageBlockTable value="{!contacts}" var="ct"> <apex:column value="{!ct.LastName}"> <apex:facet name="header"> <apex:commandLink action="{!sortByLastName}" reRender="contacts_list"> Last Name</apex:commandLink> </apex:facet> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
A. The reRender attribute on <apex:commandLink> prevents the error message from being displayed</apex:commandLink>
B. The <apex:pageMessages> message component has not been added to the Visualforce page</apex:pageMessages>
C. The Visualforce page refreshes and is unable to receive and display the error message
D. The custom controller method is lacking additional parameters in ApexPage.addMessage()
B. The <apex:pageMessages> message component has not been added to the Visualforce page</apex:pageMessages>
The <apex:pageMessages> component is used to display all messages that are generated for all components on the current page including error messages.</apex:pageMessages>
The Apex method for generating a message is ApexPages.addMessage(ApexPages.Message message). The page will only clear the added message on the next page load. The reRender attribute is used for specifying the id of the page component to update when implementing partial page updates.
} public Contact getMore(){ // get the next item } } ``` B. ``` public class ContactsCustomIterator implements CustomIterator<Contact>{ public ContactsCustomIterator(List<Contact> contacts){ // constructor code }
public Boolean hasNext(){ // check if there is a next item to traverse } public Contact next(){ // get the next item } } ``` C. ``` public class ContactsCustomIterator implements Iterator<Contact>{ public ContactsCustomIterator(List<Contact> contacts){ // constructor code }
public Boolean hasNext(){ // check if there is a next item to traverse } public Contact next(){ // get the next item } } ``` D. ``` public class ContactsCustomIterator implements CustomIterator<Contact>{
public ContactsCustomIterator(List<Contact> contacts){ // constructor code }
public Boolean hasMore(){ // check if there is a next item to traverse
} public Contact nextItem(){ // get the next item }
} ```
for (Contact con : Trigger.new) { if (con.PostalCode__c != null) { List<State__c> states = [SELECT StateId__c, PostalCode__c From State__c WHERE PostalCode__c = :con.PostalCode__c]; if (states.size() > 0) { con.StateId__c = states[0].StateId__c; } } }``` A. Condition is invalid and will always be null B. Variable 'con' is not declared C. No update DML over list of Contacts D. SOQL query is located inside the for loop code
- >
B. List
- >
SOSL statements evaluate to a list of lists of sObjects. Therefore, to store the search results of a SOSL query,
- >> can be used in Apex. Each list contains the search results for a particular sObject type. If no records are returned for a specified sObject type, the search results include an empty list for that sObject.
[SOQL and SOSL Queries](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL.htm)