You need to sign in to do that
Don't have an account?
cloud47
Trailhead - Getting Started with Apex Triggers Module - Compile Error
On Getting Started with Apex Triggers module but getting compile error in my Dev Console - Variable does not exist: EmailManager.
Have manually typed sample code, and pasted from module with same error. Should I be looking for a setup item in my dev org, thats not enabled?
Code
trigger ExampleTrigger on Contact (after insert, after delete) {
if (Trigger.isInsert) {
Integer recordCount = Trigger.New.size();
// Call a utility method from another class
EmailManager.sendMail('Your email address', 'Trailhead Trigger Tutorial',
recordCount + ' contact(s) were inserted.');
}
else if (Trigger.isDelete) {
// Process after delete
}
}
What am I not seeing?
Have manually typed sample code, and pasted from module with same error. Should I be looking for a setup item in my dev org, thats not enabled?
Code
trigger ExampleTrigger on Contact (after insert, after delete) {
if (Trigger.isInsert) {
Integer recordCount = Trigger.New.size();
// Call a utility method from another class
EmailManager.sendMail('Your email address', 'Trailhead Trigger Tutorial',
recordCount + ' contact(s) were inserted.');
}
else if (Trigger.isDelete) {
// Process after delete
}
}
What am I not seeing?
nagachandra kn
Create a new class and copy this code
and try to save the trigger. Krishna Sambaraju
That example in trailhead was showing how you can call a method from a custom class. You need to build a class "EmailManager" with a static method "sendMail" to use that.