Create a Visualforce Page

Create a Visualforce page that your engineers can use to indicate that they’re at their stations and ready for takeoff. For now, just create the Visualforce page. Later, when you have some downtime in deep space, you can add an Apex controller and some more page components.
  • Create a Visualforce page named StationCheck.
  • Copy the code for the FlightSystemsChecklist page and paste it into your new StationCheck page.
  • Change the contents of the heading (<h1>) from “Checklist” to “Station Status”.
  • Change the apex:form id from “engineReadinessChecklist” to “stationReadinessChecklist”.
  • Change the pageBlock title from “Flight Systems Checklist” to “Station Readiness Checklist”.
  • Delete all of the code from the line that contains “<!–First Section–>” to the last line that contains “</apex:pageBlockSection>”.
  • Save your Visualforce page, and then click Preview and ensure that the page loads.

Create a Perspective to Generate and Analyze Logs

Generate a debug log, and create a custom perspective to analyze it.
  • For the SFDC_DevConsole debug level, set the logging level for ApexCode to “FINEST”.
  • Use Execute Anonymous to execute your EmailMissionSpecialist Apex class, using your email address.
  • Open the Execution Log and view the following panels: Stack Tree, Execution Stack, Source, and Execution Overview.
  • Create a custom perspective using these panels. Call the perspective “Execution Details”.

Set Checkpoints to Find Errors in Your Code

Set a checkpoint in the EmailMissionSpecialist class. Then, execute the class using a valid email address, and analyze the objects logged at the checkpoint. Make sure that line 12 of your EmailMissionSpecialist Apex class still contains this code:

  • Messaging.SendEmailResult[] results = Messaging.sendEmail(

If line 12 doesn’t contain that code, find the original version of the EmailMissionSpecialist class in Unit 2: Navigate and Edit Source Code, and replace the contents of EmailMissionSpecialist.apxc with that version. Then, set a checkpoint on line 12 and execute the EmailMissionSpecialist class using the Execute Anonymous statement that you used earlier in this unit.

  • Set a checkpoint on line 12 of the EmailMissionSpecialist class.
  • Use Execute Anonymous to execute the EmailMissionSpecialist Apex class, using your email address.
  • Observe the checkpoint results and see the values of the objects in memory.

Write an Inline SOSL Search to Return Database Values

Now that you’ve successfully avoided collision with asteroid 2014 QO441, contact Mission Control at the Neptune Space Station to get cleared for landing so you can take a well-deserved break. Write an inline SOSL search to find and return the contact details of the Mission Specialist at the Neptune Space Station.

Using Execute Anonymous, like we did when we inserted records for the Control Engineers, insert the contact details for the Mission Specialist on Neptune.

Contact thisContact = new Contact( Firstname=’Brian’, Lastname=’Dent’, Phone='(619)852-4569′, Department=’Mission Control’, Title=’Mission Specialist – Neptune’, Email=’briandent@trailhead.com’);
insert thisContact;

  • Search for the inserted record with an inline SOSL search, using Execute Anonymous. Instead of finding ‘Crisis’, like we did when we used Execute Anonymous to look for the Control Engineers’ records, search for ‘Mission Control’. Use the System.debug() method to display the contact’s “lastname, firstname” in your debug log .
  • Make sure that you see the returned records in the debug log.