• Shailaja Geela
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I was doing the trailhead challenge on "Create SOQL Queries in Apex Classes"
Create a class
Name: AccountUtility
Create a method
Name: viewAnnualRevenue
Keywords: public, static, and void
Create a list
Name: accountsList
Create a query and assign the results to a list
Fields: Name and annual revenue (Hint: Use API names, not field names or labels)
Object: Account
Create a for loop that iterates through the query results
Object: Account
List name: accountsList
For each item, concatenate the account name, followed by a colon, followed by the account’s annual revenue: <account name> : <annual revenue>
Store the concatenated string in a variable named acctRev
Print the acctRev variable to the debug log
i write a code that shows me error
public class AccountUtility{
Public static void viewannualRevenue() {
List<Account>  accountlist = [ SELECT Name , annual Revenue From Account];
for(Account acc : accountlist){
string  accRev='<account name>: ' +acc.name+ , '<annual revenue>: ' +acc.annualrevenue;
System.debug(accRev);
}
}
}
thxx for help..
I have been trying to deploy apex classes to a Trailhead Playgound as well as a developer org, but I receive the error "SFDX: Deploy Source to Org failed to run" in VS Code. 

Did I miss something when I set-up VS Code?
  • Salesforce CLI is up to date
  • All extensions are up to date
  • The orgs in question have been authorized successfully
  • The CLI appears to be installed correctly (when I run "sfdx" in the Terminal, I receive the Salesforce CLI menu)

This is the Salesforce CLI output:
Starting SFDX: Deploy Source to Org
11:35:46.868 sfdx force:source:deploy --sourcepath c:\Salesforce\VSCodeQuickStart\force-app --json --loglevel fatal
11:35:48.630 sfdx force:source:deploy --sourcepath c:\Salesforce\VSCodeQuickStart\force-app --json --loglevel fatal ended with exit code 1

Any help would be much appreciated!
public class ContactAndLeadSearch {
public static List<List<SObject>> searchContactsAndLeads(string FN)
{
    List<List<sObject>> searchList = [FIND 'FN' IN all fields 
RETURNING Contact(FirstName,LastName) ,Lead(FirstName,Lastname)];
//Contact[] searchContacts = (Contact[])searchList[0];
//Lead[] searchLeads = (Lead[])searchList[1];
return searchList;
   

}
}

Please someone correct this code ,, this one was nt fulfilling the challenge req.