Skip to main content
On execution this in my Anonymous window --

List<List<sObject>> searchList = [FINd 'Mission Control' in ALL Field

                                   RETURNING Contact(FirstName,LastName,Email,Phone,Department)];

 Contact[] searchContacts = (Contact[])searchList[0];

    System.debug(searchContacts[0].LastName + ' ,' + searchContacts[0].FirstName);

a PopBox says that-

Unexpected Token at Line 1

 
8 respostas
  1. 29 de dez. de 2017, 19:46
    Hi Sandeep ,

    You are not putting the system.debug correctly for the challenge.

    Please try with below code. This will work fine

    List<List<sObject>> searchList = [FIND 'Mission Control' IN ALL FIELDS

    RETURNING Contact(FirstName, LastName,

    Phone, Email, Description)];

    Contact[] searchContacts = (Contact[])searchList[0];

    System.debug(searchContacts[0].LastName + ', ' + searchContacts[0].FirstName);

    Reason :

    You have put two extra spaces  in comma . Change below to

    System.debug(searchContacts[0].LastName + ' , ' + searchContacts[0].FirstName);

    to

    System.debug(searchContacts[0].LastName + ', ' + searchContacts[0].FirstName);

    Your debug line is causing the challenge not to be completed.

    Happy TrailBlazing :)