You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we need our query to include related record data we create an instance of our parent selector. In this case, Accounts and provide the query factory with the relationship.
public List<Contact> selectWithAccountData(){
fflib_QueryFactory contactQueryFactory = newQueryFactory();
new AccountSelector().configureQueryFactoryFields(contactQueryFactory,
Contact.AccountId.getDescribe().getRelationshipName());
return Database.query(contactQueryFactory.toSOQL());
}
Running this query will generate the following query string: SELECT Account.AccountNumber, Account.Id,
Account.Industry, Account.Name, Account.NumberOfEmployees,
Account.Rating, AccountId,
Email, Id, Name, Phone, Title
FROM Contact
ORDER BY
Name ASC
NULLS FIRST
The text was updated successfully, but these errors were encountered:
bdJohnson72
changed the title
Sample code to query related records
Sample code to query related records //Suggested Wiki Update
Mar 16, 2023
If we need our query to include related record data we create an instance of our parent selector. In this case, Accounts and provide the query factory with the relationship.
Running this query will generate the following query string:
SELECT Account.AccountNumber, Account.Id,
Account.Industry, Account.Name, Account.NumberOfEmployees,
Account.Rating, AccountId,
Email, Id, Name, Phone, Title
FROM Contact
ORDER BY
Name ASC
NULLS FIRST
The text was updated successfully, but these errors were encountered: