ForceChallenges
ProblemsDailyNotesInterview
Sign in

Practice

All problemsSOQL practiceApex trigger challengesDaily challengeOpportunityTrigger.oldMapBefore UpdateBulkificationContactValidationGROUP BYSemi-JoinAccountBefore Insert

Interview questions

All questionsAdminAdministrationApexApex TriggerAsync ApexDevelopmentField ServiceField ServiceIntegrationLwc

By company

DeloitteSalesforceAccentureInfosysPwCCognizant

Learn

Study notes

ForceChallenges

AboutContact usPrivacy PolicyTerms of ServiceFor AI assistants (llms.txt)
© 2026 ForceChallenges · Salesforce SOQL & Apex trigger practice
Development questions17 of 102
DevelopmentMedium 1 min read

Write a SOSL query to search for the string 'Universal' across Account, Contact, and Lead returning specific fields from each object (FIND 'Universal*' IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, LastName, Email), Lead(Id, Company)).

Asked atInfosysWiproTCSAccenture

Answer

SOSL searches text across multiple objects and returns a list of lists, one per object in the RETURNING clause.

apex
List<List<SObject>> results = [FIND 'Universal*' IN ALL FIELDS
    RETURNING Account(Id, Name), Contact(Id, LastName, Email), Lead(Id, Company)];
List<Account> accs = (List<Account>) results[0];
List<Contact> cons = (List<Contact>) results[1];
List<Lead> leads = (List<Lead>) results[2];

The * is a wildcard; use IN NAME FIELDS to limit the search scope.

soslscenariosearch
Practice SOQL & Apex
PreviousWrite a SOQL query to fetch all active ValidationRule or CustomField metadata records using the Tooling API query structure.Next Write a SOQL query to fetch all Case records that have been escalated and have at least one CaseComment created by a Customer Community User.

More Development questions

  • What is reactivity in LWC and when does a field trigger a re-render?
  • What are the best practices to improve LWC performance?
  • How do you unit test an LWC with Jest?
  • How do you use a third-party JavaScript library or static resource in LWC?
  • Why can renderedCallback run multiple times and how do you prevent repeated execution?