+ Start a Discussion
Carol WalgenwittCarol Walgenwitt 

Execute an Apex Class

I am working on the exercice in Navigate and Edit Source Code - I ccreated the Apex Class and was trying to execute using  -  Debug | Open Execute Anonymous Window. as per the instructions - I put in my email address and clicked execute but I do not get any email response showing my execute worked - What did I do wrong? I attached screen shots of my code . Thank youscreen shot of my codescreen shot of my codescreen shot of my code
Vishwajeet kumarVishwajeet kumar
Hello,
On Developer Console Execute anonymous window, you can select option to open debug log. In Debug logs, you can check any errors or verify if your sucessful email debug statment has been printed.

I'm assuming you are testing this call by running code something like this: 

 EmailMissonSpecialist v_EmailClass = new EmailMissonSpecialist();
 v_EmailClass.senEmail('Carol.Walgenwitt@test.com', 'Test Email Subject', 'Test Email Body');


Thanks
Suraj Tripathi 47Suraj Tripathi 47
Hi,

You must execute by providing the required parameters:-
EmailMissonSpecialist emailInstance = new EmailMissonSpecialist();
 emailInstance.senEmail('abc@test.com', 'Test Subject', 'Test Body');
If still, you are not getting email please debug each step.

Please mark it as Best Answer if it helps you.

Thanks & Regards
Suraj Tripathi

 
veer soniveer soni
hi Carol,
try once again with following Instruction.
1.) open your developer console simply Ctrl + E Or  Debug tab => Open excute anoymswindw. and run following code.
EmailMissonSpecialist emailInstance = new EmailMissonSpecialist();
 emailInstance.sendEmail('test123@gmail.com', 'Salesforce Email', 'No Body Available');
I think this time It should be worked.
let me know if it helps you by marking it as best answer.
Thank you
 
mukesh guptamukesh gupta
Hi Carol,

Your code is perfect,

Please check you email Deliverability:-  Access level  should be All email 

User-added image

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh
Carol WalgenwittCarol Walgenwitt
Good evening This code did not work. It did not recognize emailInstance. I received error message emailInstance Carol Ann Walgenwitt carolannwalgen@aol.com
Carol WalgenwittCarol Walgenwitt
Good evening, I did click the option to open debug log. The View Log Panels is not highlighted so I cannot click to view anything. Both boxes Show my Current Logs Only are clickec - where do I go to view my logs? Carol Ann Walgenwitt carolannwalgen@aol.com
Carol WalgenwittCarol Walgenwitt
Good evening Mukesh, Where do I check my email Deliverability?  I now get and Execute Anonymous Error Line 2, Column 4 Method does not exist or incorrect signature: void sendEmail(String, String, String) from the type EmailMissionSpecialist I believe it is because of this codepublic class EmailMissionSpecialist {// Public methodpublic void sendEmail(String address , String subject , String body ) {  Can you help me out with this? Thank you. Carol Ann Walgenwitt carolannwalgen@aol.com
Carol WalgenwittCarol Walgenwitt
Good evening, I now get this error message. I attached the screen shot of my code Carol Ann Walgenwitt carolannwalgen@aol.com
Carol WalgenwittCarol Walgenwitt
Carol Ann Walgenwitt carolannwalgen@aol.com -----Original Message----- From: Carol Walgenwitt To: 0-1fcame3ih4pyu1.szaqdm9ip1g936da.ilbb7dhv1ig3iq71@q56gtf53zpg1bpgi.xckx0gktwhdzs6vy.f-55kkmai.na93.chatter.salesforce.com Sent: Wed, Jun 16, 2021 7:08 pm Subject: Re: (Salesforce Developers): New reply to your question. Good evening, I now get this error message. I attached the screen shot of my code Carol Ann Walgenwitt carolannwalgen@aol.com