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
rachel watsonrachel watson 

Trailhead - Developer Beginner -> Apex Testing Testing-> Apex Triggers

I copied and pasted a pre-made trigger from the challenge so I could write the test class, but the trigger will not save:


User-added image
The error is:  unexpected token: 'trigger'

This is a screenshot of the challenge:

User-added image

I clicked on the link to the challenge and it took me to GitHub where I copied/pasted the trigger into my Dev. org.  I cannot continue with this challenge until this saves. What is wrong?


 
Wahid BuhariWahid Buhari
@rachel
You are trying to create trigger in a Apex Class. You should go File->New->Apex Trigger instead in developer console.
SandhyaSandhya (Salesforce Developers) 

Hi Rachel Watson,

Please check if you have created a trigger from below path.
 Developer console file--new--ApexTrigger.
 
Please see below screenshots.
User-added imageUser-added image
 
Please accept my solution as Best Answer if my answer was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
 
Thanks and Regards
Sandhya