function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Dev Console error in Trailhead exercise: The Trigger "HelloWorldTrigger " is not a legal name.

In the 'Getting Started with APEX Triggers' ( module, an error message appears when attempting the first example/exercise. 
 The instructions read: 
  • 1. In the Developer Console, click File | New | Trigger. (The menu path is actually File | New | APEX Trigger).
  • 2. Enter helloWorldTrigger for the trigger name, and then select Account for the sObject. ClickSubmit. (stet)
When clicking submit in step 2, an error message appears: "The Trigger "HelloWorldTrigger " is not a legal name." The parenthesis around HelloWorldTrigger are not entered in step 2. 

Work Around:  
In Setup go Develop | Apex Triggers
Launch the Dev Console (DC) from setup UI. 
Removed previous text from within the Query Editor tab which contained an invalid query, and was promtping an error message itself.
Continued with set 2, above. 

I was able to save the new trigger in the Dev Console. I then deleted it, closed the DC, and repeated the steps from the Trailhead exercise (where the DC was launched from Name | Dev Console, not Setup | Develop). I was then able to save the trigger without error. 

Take Away: it may have been the erronous text in the query editor, when the DC was launched from Name | DC. Subsequently adding erronous text back into the query editor, and repeating set 2 above did not throw a naming error the second time.  
Jayanth ThathapudiJayanth Thathapudi

Trigger name which your trying to create contains an extra space at the end "HelloWorldTrigger "

Try to save the trigger as "HelloWorldTrigger"

Please select as best answer if it helps you
anthony curtis 18anthony curtis 18
This worked for me
Jayanth ThathapudiJayanth Thathapudi

Please select as best answer if it helps that we close this thread:)
jayanth your answer is the best answer. Thank you for helping me.